diff options
author | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2014-11-19 03:14:29 +0100 |
---|---|---|
committer | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2014-11-19 03:14:29 +0100 |
commit | 2c59dcacc2163ac48e36f1fde5fa6b10f769442f (patch) | |
tree | 2962def04eb00ce79cc0b490577fb1b5d71c1963 /views.py | |
parent | 4f377e9e70cce40fec9bed51b76d0650d5a750df (diff) | |
download | padlite-teams-2c59dcacc2163ac48e36f1fde5fa6b10f769442f.tar.gz padlite-teams-2c59dcacc2163ac48e36f1fde5fa6b10f769442f.tar.bz2 padlite-teams-2c59dcacc2163ac48e36f1fde5fa6b10f769442f.zip |
utils: add after_this_request
With after_this_request you can simple set cookies. Used as a decorator,
it registers a function as callback to be executed just before sending
the response to the client. The callback will be executed with the
response object as argument.
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -13,6 +13,14 @@ def get_group_or_404(*query): Member.user == g.user, *query) return group + +@app.after_request +def call_after_request_callbacks(response): + for callback in getattr(g, 'after_request_callbacks', ()): + callback(response) + return response + + @app.route('/', methods=['GET', 'POST']) @templated('index.html') @auth.login_required |