Fix anonymous user has no modified_flag error

pull/1596/head
Ozzie Isaacs 4 years ago
parent ef1736b571
commit d89830af61

@ -473,7 +473,10 @@ def update_view():
#visibility = json.loads(current_user.view_settings) #visibility = json.loads(current_user.view_settings)
current_user.view_settings['series_view'] = to_save["series_view"] current_user.view_settings['series_view'] = to_save["series_view"]
# current_user.view_settings = json.dumps(visibility) # current_user.view_settings = json.dumps(visibility)
try:
flag_modified(current_user, "view_settings") flag_modified(current_user, "view_settings")
except AttributeError:
pass
ub.session.commit() ub.session.commit()
except InvalidRequestError: except InvalidRequestError:
log.error("Invalid request received: %r ", request, ) log.error("Invalid request received: %r ", request, )
@ -626,7 +629,10 @@ def render_books_list(data, sort, book_id, page):
else: else:
try: try:
current_user.view_settings[data] = sort current_user.view_settings[data] = sort
try:
flag_modified(current_user, "view_settings") flag_modified(current_user, "view_settings")
except AttributeError:
pass
ub.session.commit() ub.session.commit()
except InvalidRequestError: except InvalidRequestError:
log.error("Invalid request received: %r ", request, ) log.error("Invalid request received: %r ", request, )
@ -1014,8 +1020,11 @@ def update_table_settings():
# vals = request.get_json() # vals = request.get_json()
# ToDo: Save table settings # ToDo: Save table settings
current_user.view_settings['table'] = json.loads(request.data) current_user.view_settings['table'] = json.loads(request.data)
try:
try: try:
flag_modified(current_user, "view_settings") flag_modified(current_user, "view_settings")
except AttributeError:
pass
ub.session.commit() ub.session.commit()
except InvalidRequestError: except InvalidRequestError:
log.error("Invalid request received: %r ", request, ) log.error("Invalid request received: %r ", request, )

Loading…
Cancel
Save