diff options
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")) ## |