Move assignment of new_coverpath
With the assignment originally being within the try, if the try failed, the exception wouldn't have access to the value
This commit is contained in:
parent
1a1d105fae
commit
704dcb3e58
1 changed files with 1 additions and 2 deletions
|
@ -223,7 +223,6 @@ def delete_book(book_id, book_format):
|
||||||
getattr(book, cc_string).remove(del_cc)
|
getattr(book, cc_string).remove(del_cc)
|
||||||
log.debug('remove ' + str(c.id))
|
log.debug('remove ' + str(c.id))
|
||||||
calibre_db.session.delete(del_cc)
|
calibre_db.session.delete(del_cc)
|
||||||
calibre_db.session.commit()
|
|
||||||
else:
|
else:
|
||||||
modify_database_object([u''], getattr(book, cc_string), db.cc_classes[c.id],
|
modify_database_object([u''], getattr(book, cc_string), db.cc_classes[c.id],
|
||||||
calibre_db.session, 'custom')
|
calibre_db.session, 'custom')
|
||||||
|
@ -833,8 +832,8 @@ def upload():
|
||||||
|
|
||||||
# move cover to final directory, including book id
|
# move cover to final directory, including book id
|
||||||
if has_cover:
|
if has_cover:
|
||||||
|
new_coverpath = os.path.join(config.config_calibre_dir, db_book.path, "cover.jpg")
|
||||||
try:
|
try:
|
||||||
new_coverpath = os.path.join(config.config_calibre_dir, db_book.path, "cover.jpg")
|
|
||||||
copyfile(meta.cover, new_coverpath)
|
copyfile(meta.cover, new_coverpath)
|
||||||
os.unlink(meta.cover)
|
os.unlink(meta.cover)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
|
Loading…
Reference in a new issue