From 09d0598c2f47088c8b7cfb85a34b5366fab64d7d Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Mon, 1 May 2023 19:21:17 -0700 Subject: [PATCH] Remove use of deprecated before_first_request decorator (#1162) --- python/web/src/web.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/web/src/web.py b/python/web/src/web.py index 5ac8ea22..270e3dfc 100644 --- a/python/web/src/web.py +++ b/python/web/src/web.py @@ -1369,15 +1369,16 @@ def healthcheck(): return "", 200 -@APP.before_first_request +@APP.before_request def detect_locale(): """ Get the detected locale to use for UI string translations. This requires the Flask app to have started first. """ - session["language"] = get_locale() - piscsi_cmd.locale = session["language"] - file_cmd.locale = session["language"] + if "language" not in session.keys(): + session["language"] = get_locale() + piscsi_cmd.locale = session["language"] + file_cmd.locale = session["language"] @APP.before_request