Cleanup previous PR

This commit is contained in:
Kovid Goyal 2023-02-19 19:08:48 +05:30
parent 916ec43250
commit 1ef455148a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 16 deletions

View File

@ -334,9 +334,8 @@ class FileTypePlugin(Plugin): # {{{
#: methods of the plugin are called. #: methods of the plugin are called.
on_postimport = False on_postimport = False
#: If True, this plugin is run after a book file is added #: If True, this plugin is run after a book is converted.
#: to the database. In this case the postconvert method of #: In this case the postconvert method of the plugin is called.
#: the plugin is called.
on_postconvert = False on_postconvert = False
#: If True, this plugin is run after a book file is deleted #: If True, this plugin is run after a book file is deleted
@ -390,8 +389,8 @@ class FileTypePlugin(Plugin): # {{{
def postconvert(self, book_id, book_format, db): def postconvert(self, book_id, book_format, db):
''' '''
Called post conversion, i.e., after the book file has been added to the database. Note that Called post conversion, i.e., after the conversion output book file has been added to the database.
it is run after a conversion only, not after a book is added. It is useful for modifying Note that it is run after a conversion only, not after a book is added. It is useful for modifying
the book record based on the contents of the newly added file. the book record based on the contents of the newly added file.
:param book_id: Database id of the added book. :param book_id: Database id of the added book.

View File

@ -210,9 +210,8 @@ def run_plugins_on_postimport(db, book_id, fmt):
with plugin: with plugin:
try: try:
plugin.postimport(book_id, fmt, db) plugin.postimport(book_id, fmt, db)
except: except Exception:
print('Running file type plugin %s failed with traceback:'% print(f'Running file type plugin {plugin.name} failed with traceback:', file=sys.stderr)
plugin.name)
traceback.print_exc() traceback.print_exc()
@ -224,9 +223,8 @@ def run_plugins_on_postconvert(db, book_id, fmt):
with plugin: with plugin:
try: try:
plugin.postconvert(book_id, fmt, db) plugin.postconvert(book_id, fmt, db)
except: except Exception:
print('Running file type plugin %s failed with traceback:'% print(f'Running file type plugin {plugin.name} failed with traceback:', file=sys.stderr)
plugin.name)
traceback.print_exc() traceback.print_exc()
@ -238,9 +236,8 @@ def run_plugins_on_postdelete(db, book_id, fmt):
with plugin: with plugin:
try: try:
plugin.postdelete(book_id, fmt, db) plugin.postdelete(book_id, fmt, db)
except: except Exception:
print('Running file type plugin %s failed with traceback:'% print(f'Running file type plugin {plugin.name} failed with traceback:', file=sys.stderr)
plugin.name)
traceback.print_exc() traceback.print_exc()
@ -254,8 +251,7 @@ def run_plugins_on_postadd(db, book_id, fmt_map):
try: try:
plugin.postadd(book_id, fmt_map, db) plugin.postadd(book_id, fmt_map, db)
except Exception: except Exception:
print('Running file type plugin %s failed with traceback:'% print(f'Running file type plugin {plugin.name} failed with traceback:', file=sys.stderr)
plugin.name)
traceback.print_exc() traceback.print_exc()
# }}} # }}}