From 184ce23351d8c11fc42845f5559d57959cb9cf91 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 6 Nov 2023 18:05:36 +0100 Subject: [PATCH] Catch error with tornado on restart --- cps/admin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index 045a9523..20e901e3 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -102,10 +102,13 @@ def admin_required(f): @admi.before_app_request def before_request(): - if not ub.check_user_session(current_user.id, - flask_session.get('_id')) and 'opds' not in request.path \ - and config.config_session == 1: - logout_user() + try: + if not ub.check_user_session(current_user.id, + flask_session.get('_id')) and 'opds' not in request.path \ + and config.config_session == 1: + logout_user() + except AttributeError: + pass # ? fails on requesting /ajax/emailstat during restart ? g.constants = constants g.google_site_verification = os.getenv('GOOGLE_SITE_VERIFICATION', '') g.allow_registration = config.config_public_reg