Improved errorhandling during editing of books

pull/519/merge
OzzieIsaacs 6 years ago
parent fbe2f5384b
commit 4f1754c1e4

@ -1649,6 +1649,8 @@ def shutdown():
db.engine.dispose() db.engine.dispose()
ub.session.close() ub.session.close()
ub.engine.dispose() ub.engine.dispose()
# stop gevent server
# gevent_server.stop()
# stop tornado server # stop tornado server
server = IOLoop.instance() server = IOLoop.instance()
server.add_callback(server.stop) 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() is_format = db.session.query(db.Data).filter(db.Data.book == book_id).filter(db.Data.format == file_ext.upper()).first()
if is_format: if is_format:
# Format entry already exists, no need to update the database # Format entry already exists, no need to update the database
app.logger.info('Bokk format already existing')
pass pass
else: else:
db_format = db.Data(book_id, file_ext.upper(), file_size, file_name) 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() to_save = request.form.to_dict()
try:
if book.title != to_save["book_title"]: if book.title != to_save["book_title"]:
book.title = to_save["book_title"] book.title = to_save["book_title"]
edited_books_id.add(book.id) edited_books_id.add(book.id)
@ -3219,6 +3223,11 @@ def edit_book(book_id):
flash( error, category="error") flash( error, category="error")
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc, return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
title=_(u"edit metadata")) 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): def save_cover(url, book_path):

Loading…
Cancel
Save