First fix for #2325 (edit book table with readonly database)
This commit is contained in:
parent
d80297e1a8
commit
547ea93dc9
|
@ -1152,6 +1152,7 @@ def edit_list_book(param):
|
||||||
vals = request.form.to_dict()
|
vals = request.form.to_dict()
|
||||||
book = calibre_db.get_book(vals['pk'])
|
book = calibre_db.get_book(vals['pk'])
|
||||||
# ret = ""
|
# ret = ""
|
||||||
|
try:
|
||||||
if param == 'series_index':
|
if param == 'series_index':
|
||||||
edit_book_series_index(vals['value'], book)
|
edit_book_series_index(vals['value'], book)
|
||||||
ret = Response(json.dumps({'success': True, 'newValue': book.series_index}), mimetype='application/json')
|
ret = Response(json.dumps({'success': True, 'newValue': book.series_index}), mimetype='application/json')
|
||||||
|
@ -1225,7 +1226,7 @@ def edit_list_book(param):
|
||||||
else:
|
else:
|
||||||
return _("Parameter not found"), 400
|
return _("Parameter not found"), 400
|
||||||
book.last_modified = datetime.utcnow()
|
book.last_modified = datetime.utcnow()
|
||||||
try:
|
|
||||||
calibre_db.session.commit()
|
calibre_db.session.commit()
|
||||||
# revert change for sort if automatic fields link is deactivated
|
# revert change for sort if automatic fields link is deactivated
|
||||||
if param == 'title' and vals.get('checkT') == "false":
|
if param == 'title' and vals.get('checkT') == "false":
|
||||||
|
@ -1233,7 +1234,10 @@ def edit_list_book(param):
|
||||||
calibre_db.session.commit()
|
calibre_db.session.commit()
|
||||||
except (OperationalError, IntegrityError) as e:
|
except (OperationalError, IntegrityError) as e:
|
||||||
calibre_db.session.rollback()
|
calibre_db.session.rollback()
|
||||||
log.error("Database error: %s", e)
|
log.error("Database error: {}".format(e))
|
||||||
|
ret = Response(json.dumps({'success': False,
|
||||||
|
'msg': 'Database error: {}'.format(e.orig)}),
|
||||||
|
mimetype='application/json')
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user