summaryrefslogtreecommitdiffstats
path: root/app.py
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-28 03:10:09 +0200
committerMarian Sigler <m@qjym.de>2012-09-28 03:10:09 +0200
commita9b2f0624d5f9095747e9c2a8518199375c5e815 (patch)
treeb0a6de8845fca2d8a1ce71e5dbccac0cde4639d3 /app.py
parentbbdc690a1f69c9e7f286a5fbd0cb64403d51c721 (diff)
downloadweb-a9b2f0624d5f9095747e9c2a8518199375c5e815.tar.gz
web-a9b2f0624d5f9095747e9c2a8518199375c5e815.tar.bz2
web-a9b2f0624d5f9095747e9c2a8518199375c5e815.zip
use context_processor to create a default context
Before, we did it in templated which a) is not the recommended way, b) does only work when @templated is used and c) didn't work when directly returning response objects.
Diffstat (limited to 'app.py')
-rw-r--r--app.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/app.py b/app.py
index 4c93ccf..f06eb0b 100644
--- a/app.py
+++ b/app.py
@@ -43,6 +43,12 @@ def read_blacklist():
with open(app.config['USERNAME_BLACKLIST_FILE']) as f:
app.username_blacklist = f.read().split('\n')
+@app.context_processor
+def template_default_context():
+ return {
+ 'app': app
+ }
+
@app.route('/', methods=['GET', 'POST'])
@templated('index.html')