From 27506b36c2b9646b7bc7cae645a1e05336c32bc0 Mon Sep 17 00:00:00 2001 From: Snakes Date: Thu, 1 Dec 2022 17:24:41 -0500 Subject: [PATCH] Fix unbound ORM object erroring during 500 handler. The 500 fixed in 71738b05fc revealed that attempting to access g.v at all during an error handler can potentially cause its own error. In particular, html_head L111 accessing v.themecolor errored because we roll back the database session during 500 handling. There's no good solution other than specifically not passing v to 500 error pages. However, in the interest of failing fast and ensuring error handlers always complete, we instead go back to the previous behavior of not treating users as logged in for error pages. --- files/routes/errors.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/routes/errors.py b/files/routes/errors.py index d1e54bded..479c6eab7 100644 --- a/files/routes/errors.py +++ b/files/routes/errors.py @@ -36,9 +36,7 @@ def error(e): if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": title, "code": e.code, "description": msg, "details": details}, e.code img = ERROR_MARSEYS.get(e.code, 'marseyl') - if hasattr(g, "v"): v = g.v - else: v = None - return render_template('errors/error.html', title=title, msg=msg, details=details, img=img, v=v), e.code + return render_template('errors/error.html', title=title, msg=msg, details=details, img=img), e.code @app.errorhandler(401) def error_401(e):