diff options
author | Florian Dold <florian@dold.me> | 2021-04-22 13:57:43 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-04-22 13:57:43 +0200 |
commit | 58a059b94afee29767303b399b48629985a48942 (patch) | |
tree | b82d875c06fa1e81439bd251604f8014816136d9 /talermerchantdemos/blog | |
parent | c8730857293c694449110ec289210e7ec4f32aa4 (diff) | |
download | taler-merchant-demos-58a059b94afee29767303b399b48629985a48942.tar.gz taler-merchant-demos-58a059b94afee29767303b399b48629985a48942.tar.bz2 taler-merchant-demos-58a059b94afee29767303b399b48629985a48942.zip |
refactor base template, language selector
Diffstat (limited to 'talermerchantdemos/blog')
-rw-r--r-- | talermerchantdemos/blog/blog.py | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/talermerchantdemos/blog/blog.py b/talermerchantdemos/blog/blog.py index d1a2865..2981f05 100644 --- a/talermerchantdemos/blog/blog.py +++ b/talermerchantdemos/blog/blog.py @@ -40,6 +40,7 @@ from talermerchantdemos.httpcommon import ( self_localized, Deadline, BackendException, + make_utility_processor, ) @@ -105,27 +106,9 @@ LOGGER.info( "Operating with the following translations available: " + " ".join(translations) ) -app.add_template_global(self_localized) - - -## -# Extends the templating language with a function (@c env) -# that fetches values from the environment. -# -# @return a @a dict containing the extension. -@app.context_processor -def utility_processor(): - # These helpers will be available in templates - def env(name, default=None): - return os.environ.get(name, default) - - def getactive(): - return "blog" - - def getlang(): - return get_locale() - - return dict(env=env, getactive=getactive, getlang=getlang) +# Add context processor that will make additional variables +# and functions available in the template. +app.context_processor(make_utility_processor("blog")) ## |