diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-11-25 22:45:43 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-11-25 22:45:43 +0100 |
commit | b2618e9404b84cc62d4becb02436233a0d53b375 (patch) | |
tree | a31f2dc76d23967fa0243374cf475923a4b7e451 /pyaggr3g470r/lib/view_utils.py | |
parent | Updated default platform URL (for Heroku...). (diff) | |
download | newspipe-b2618e9404b84cc62d4becb02436233a0d53b375.tar.gz newspipe-b2618e9404b84cc62d4becb02436233a0d53b375.tar.bz2 newspipe-b2618e9404b84cc62d4becb02436233a0d53b375.zip |
Rfactorization. Just a start...
Diffstat (limited to 'pyaggr3g470r/lib/view_utils.py')
-rw-r--r-- | pyaggr3g470r/lib/view_utils.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/pyaggr3g470r/lib/view_utils.py b/pyaggr3g470r/lib/view_utils.py deleted file mode 100644 index 0cfe62c4..00000000 --- a/pyaggr3g470r/lib/view_utils.py +++ /dev/null @@ -1,26 +0,0 @@ -from functools import wraps -from flask import request, Response, make_response -from pyaggr3g470r.lib.utils import to_hash - - -def etag_match(func): - @wraps(func) - def wrapper(*args, **kwargs): - response = func(*args, **kwargs) - if isinstance(response, Response): - etag = to_hash(response.data) - headers = response.headers - elif type(response) is str: - etag = to_hash(response) - headers = {} - else: - return response - if request.headers.get('if-none-match') == etag: - response = Response(status=304) - response.headers['Cache-Control'] \ - = headers.get('Cache-Control', 'pragma: no-cache') - elif not isinstance(response, Response): - response = make_response(response) - response.headers['etag'] = etag - return response - return wrapper |