From e3868b24c2a25b65fc072b4ba678743bbaf9de1c Mon Sep 17 00:00:00 2001
From: Jan Hartig <jan.hartig@ptb.de>
Date: Thu, 17 Aug 2023 16:46:23 +0200
Subject: [PATCH] Check localisations before importing routes

---
 app.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/app.py b/app.py
index ff77e3c..b2d552c 100644
--- a/app.py
+++ b/app.py
@@ -18,18 +18,16 @@ def create_app():
     with open("localisations.toml", "rb") as file:
         localisations = tomllib.load(file)
 
+    for language in app.config["ENABLED_LOCALISATIONS"]:
+        check_localisation(app.logger, localisations, language)
+
     app.config["LOCALISATIONS"] = localisations
-    del localisations
+
+    app.logger.info("Localisations loaded.")
 
     with app.app_context():
         import routes
 
-    for language in app.config["ENABLED_LOCALISATIONS"]:
-        check_localisation(app.logger, app.config["LOCALISATIONS"], language)
-    del language
-
-    app.logger.info("Localisations loaded.")
-
     return app
 
 
-- 
GitLab