From f8e6ce67c251b599959b197cb4f91963a1845db0 Mon Sep 17 00:00:00 2001
From: Maximilian Moser <maximilian.moser@tuwien.ac.at>
Date: Thu, 6 Feb 2025 11:54:44 +0100
Subject: [PATCH] Override "config" global for Jinja templates
* previously, the global was still set to the original Flask config
which may not be in sync with the overridden config and thus cause
unexpected behavior
---
invenio_config_tuw/startup.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/invenio_config_tuw/startup.py b/invenio_config_tuw/startup.py
index 73a1b71..09e7b8b 100644
--- a/invenio_config_tuw/startup.py
+++ b/invenio_config_tuw/startup.py
@@ -141,6 +141,10 @@ def override_flask_config(app):
"""
app.config = TUWConfig.from_flask_config(app.config)
+ # we need to override the "config" global, as that might still be the
+ # old "normal" Flask config, and thus have different content
+ app.add_template_global(app.config, "config")
+
def patch_flask_create_url_adapter(app):
"""Patch Flask's {host,subdomain}_matching with 3.1 behavior.
--
GitLab