diff options
Diffstat (limited to 'wqflask/utility')
-rwxr-xr-x | wqflask/utility/after.py | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | wqflask/utility/benchmark.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | wqflask/utility/corr_result_helpers.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | wqflask/utility/db_tools.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | wqflask/utility/formatting.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | wqflask/utility/helper_functions.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | wqflask/utility/temp_data.py | 0 |
7 files changed, 22 insertions, 0 deletions
diff --git a/wqflask/utility/after.py b/wqflask/utility/after.py new file mode 100755 index 00000000..a3bb85e9 --- /dev/null +++ b/wqflask/utility/after.py @@ -0,0 +1,22 @@ +from __future__ import print_function, division, absolute_import + +""" +See: http://flask.pocoo.org/docs/patterns/deferredcallbacks/#deferred-callbacks + +""" + +from flask import g + +from 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 + +@app.after_request +def call_after_request_callbacks(response): + for callback in getattr(g, 'after_request_callbacks', ()): + callback(response) + return response diff --git a/wqflask/utility/benchmark.py b/wqflask/utility/benchmark.py index 182187ae..182187ae 100644..100755 --- a/wqflask/utility/benchmark.py +++ b/wqflask/utility/benchmark.py diff --git a/wqflask/utility/corr_result_helpers.py b/wqflask/utility/corr_result_helpers.py index a253026c..a253026c 100644..100755 --- a/wqflask/utility/corr_result_helpers.py +++ b/wqflask/utility/corr_result_helpers.py diff --git a/wqflask/utility/db_tools.py b/wqflask/utility/db_tools.py index 4034f39c..4034f39c 100644..100755 --- a/wqflask/utility/db_tools.py +++ b/wqflask/utility/db_tools.py diff --git a/wqflask/utility/formatting.py b/wqflask/utility/formatting.py index e53dda22..e53dda22 100644..100755 --- a/wqflask/utility/formatting.py +++ b/wqflask/utility/formatting.py diff --git a/wqflask/utility/helper_functions.py b/wqflask/utility/helper_functions.py index 44f5321e..44f5321e 100644..100755 --- a/wqflask/utility/helper_functions.py +++ b/wqflask/utility/helper_functions.py diff --git a/wqflask/utility/temp_data.py b/wqflask/utility/temp_data.py index 004d45c6..004d45c6 100644..100755 --- a/wqflask/utility/temp_data.py +++ b/wqflask/utility/temp_data.py |