aboutsummaryrefslogtreecommitdiff
path: root/web/lib/view_utils.py
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-12-12 21:14:28 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-12-17 09:42:56 +0100
commitb35e9773198ef2d8b37c4ca223f08147db47de0b (patch)
treeba4b1b171b3c1ab9414a96ad264c47b0f9d1246b /web/lib/view_utils.py
parentUpdated link to Heroku deploy button on the About page. (diff)
downloadnewspipe-b35e9773198ef2d8b37c4ca223f08147db47de0b.tar.gz
newspipe-b35e9773198ef2d8b37c4ca223f08147db47de0b.tar.bz2
newspipe-b35e9773198ef2d8b37c4ca223f08147db47de0b.zip
moving the root of source code from / to /src/
Diffstat (limited to 'web/lib/view_utils.py')
-rw-r--r--web/lib/view_utils.py26
1 files changed, 0 insertions, 26 deletions
diff --git a/web/lib/view_utils.py b/web/lib/view_utils.py
deleted file mode 100644
index d4c119da..00000000
--- a/web/lib/view_utils.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from functools import wraps
-from flask import request, Response, make_response
-from web.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
bgstack15