diff --git a/src/calibre/library/custom_columns.py b/src/calibre/library/custom_columns.py index 535b8cfb72..90af46cc42 100644 --- a/src/calibre/library/custom_columns.py +++ b/src/calibre/library/custom_columns.py @@ -257,7 +257,7 @@ class CustomColumns(object): 'SELECT id FROM %s WHERE value=?'%table, (ex,), all=False) if ex != x: self.conn.execute( - 'UPDATE %s SET value=? WHERE id=?', (x, xid)) + 'UPDATE %s SET value=? WHERE id=?'%table, (x, xid)) else: xid = self.conn.execute( 'INSERT INTO %s(value) VALUES(?)'%table, (x,)).lastrowid diff --git a/src/calibre/library/server/opds.py b/src/calibre/library/server/opds.py index 86fae8bae8..dd1e2d0bb0 100644 --- a/src/calibre/library/server/opds.py +++ b/src/calibre/library/server/opds.py @@ -322,9 +322,17 @@ class OPDSServer(object): return self.get_opds_all_books(which, page_url, up_url, version=version, offset=offset) elif type_ == 'N': - return self.get_opds_navcatalog(which) + return self.get_opds_navcatalog(which, version=version, offset=offset) raise cherrypy.HTTPError(404, 'Not found') + def get_opds_navcatalog(self, which, version=0, offset=0): + categories = self.categories_cache( + self.get_opds_allowed_ids_for_version(version)) + if which not in categories: + raise cherrypy.HTTPError(404, 'Category %r not found'%which) + + + def opds(self, version=0): version = int(version) if version not in BASE_HREFS: