mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Improved errorhandling during editing of books
This commit is contained in:
parent
fbe2f5384b
commit
4f1754c1e4
@ -1649,6 +1649,8 @@ def shutdown():
|
||||
db.engine.dispose()
|
||||
ub.session.close()
|
||||
ub.engine.dispose()
|
||||
# stop gevent server
|
||||
# gevent_server.stop()
|
||||
# stop tornado server
|
||||
server = IOLoop.instance()
|
||||
server.add_callback(server.stop)
|
||||
@ -3030,6 +3032,7 @@ def edit_book(book_id):
|
||||
is_format = db.session.query(db.Data).filter(db.Data.book == book_id).filter(db.Data.format == file_ext.upper()).first()
|
||||
if is_format:
|
||||
# Format entry already exists, no need to update the database
|
||||
app.logger.info('Bokk format already existing')
|
||||
pass
|
||||
else:
|
||||
db_format = db.Data(book_id, file_ext.upper(), file_size, file_name)
|
||||
@ -3037,6 +3040,7 @@ def edit_book(book_id):
|
||||
|
||||
to_save = request.form.to_dict()
|
||||
|
||||
try:
|
||||
if book.title != to_save["book_title"]:
|
||||
book.title = to_save["book_title"]
|
||||
edited_books_id.add(book.id)
|
||||
@ -3219,6 +3223,11 @@ def edit_book(book_id):
|
||||
flash( error, category="error")
|
||||
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
|
||||
title=_(u"edit metadata"))
|
||||
except Exception as e:
|
||||
app.logger.exception(e)
|
||||
db.session.rollback()
|
||||
flash(_("Error editing book, please check logfile for details"), category="error")
|
||||
return redirect(url_for('show_book', book_id=book.id))
|
||||
|
||||
|
||||
def save_cover(url, book_path):
|
||||
|
Loading…
Reference in New Issue
Block a user