diff options
Diffstat (limited to 'gn2/utility/after.py')
-rw-r--r-- | gn2/utility/after.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gn2/utility/after.py b/gn2/utility/after.py new file mode 100644 index 00000000..5f802d35 --- /dev/null +++ b/gn2/utility/after.py @@ -0,0 +1,15 @@ +""" +See: http://flask.pocoo.org/docs/patterns/deferredcallbacks/#deferred-callbacks + +""" + +from flask import g + +from gn2.wqflask import app + + +def after_this_request(f): + if not hasattr(g, 'after_request_callbacks'): + g.after_request_callbacks = [] + g.after_request_callbacks.append(f) + return f |