From 7761f537e676eccef34255b47ce8f9618dae6714 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 24 Jun 2016 13:22:51 +0530 Subject: [PATCH] Fix unreachable call to notify() when adding formats with the legacy API --- src/calibre/db/legacy.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/calibre/db/legacy.py b/src/calibre/db/legacy.py index c87ea942e1..7e51abd317 100644 --- a/src/calibre/db/legacy.py +++ b/src/calibre/db/legacy.py @@ -275,22 +275,16 @@ class LibraryDatabase(object): def add_format(self, index, fmt, stream, index_is_id=False, path=None, notify=True, replace=True, copy_function=None): ''' path and copy_function are ignored by the new API ''' book_id = index if index_is_id else self.id(index) - try: - return self.new_api.add_format(book_id, fmt, stream, replace=replace, run_hooks=False, dbapi=self) - except: - raise - else: - self.notify('metadata', [book_id]) + ret = self.new_api.add_format(book_id, fmt, stream, replace=replace, run_hooks=False, dbapi=self) + self.notify('metadata', [book_id]) + return ret def add_format_with_hooks(self, index, fmt, fpath, index_is_id=False, path=None, notify=True, replace=True): ''' path is ignored by the new API ''' book_id = index if index_is_id else self.id(index) - try: - return self.new_api.add_format(book_id, fmt, fpath, replace=replace, run_hooks=True, dbapi=self) - except: - raise - else: - self.notify('metadata', [book_id]) + ret = self.new_api.add_format(book_id, fmt, fpath, replace=replace, run_hooks=True, dbapi=self) + self.notify('metadata', [book_id]) + return ret # }}}