aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-07-23 20:38:31 +0200
committerDaniel Schadt <kingdread@gmx.de>2022-07-23 20:38:31 +0200
commitd8ce9e645365f5988b5ee271b5a28dceb1f2dc80 (patch)
treee7120bb010a6fe44f087d0e6bb95c4059208079f
parent9855ff27a35b518c62a58cf8ff2cf253aa4f9d98 (diff)
downloadfietsboek-d8ce9e645365f5988b5ee271b5a28dceb1f2dc80.tar.gz
fietsboek-d8ce9e645365f5988b5ee271b5a28dceb1f2dc80.tar.bz2
fietsboek-d8ce9e645365f5988b5ee271b5a28dceb1f2dc80.zip
add ETags to gpx and badge files
We cannot add them to image files, because FileResponse may use the wsgi provided file sending mechanism right when the object is created. FileResponse does however use the Last-Modified header, which is also okay.
-rw-r--r--fietsboek/views/detail.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/fietsboek/views/detail.py b/fietsboek/views/detail.py
index 80d112b..1808bda 100644
--- a/fietsboek/views/detail.py
+++ b/fietsboek/views/detail.py
@@ -55,7 +55,9 @@ def gpx(request):
:rtype: pyramid.response.Response
"""
track = request.context
- return Response(track.gpx_data, content_type="application/gpx+xml")
+ response = Response(track.gpx_data, content_type="application/gpx+xml")
+ response.md5_etag()
+ return response
@view_config(route_name='invalidate-share', request_method='POST', permission='track.unshare')
@@ -98,7 +100,9 @@ def badge(request):
:return: The HTTP response.
:rtype: pyramid.response.Response
"""
- return Response(request.context.image)
+ response = Response(request.context.image)
+ response.md5_etag()
+ return response
@view_config(route_name='image', http_cache=3600, permission='track.view')