diff --git a/pyshop/templates/pyshop/simple/show.html b/pyshop/templates/pyshop/simple/show.html index 95b00e3..215cb07 100644 --- a/pyshop/templates/pyshop/simple/show.html +++ b/pyshop/templates/pyshop/simple/show.html @@ -8,7 +8,7 @@ {%- endif -%} {%- else -%} {{f.filename}}
+ }}#md5={{ f.md5_digest }}">{{f.filename}}
{% endif -%} {% endfor -%} {% if not r.files %} @@ -24,4 +24,4 @@ {% endif %} {% endif %} {% endfor %} -{% else %}Not found, ({{package_name}} does not have any release){% endif %} \ No newline at end of file +{% else %}Not found, ({{package_name}} does not have any release){% endif %} diff --git a/pyshop/views/repository.py b/pyshop/views/repository.py index fbd5ea2..0fef60f 100644 --- a/pyshop/views/repository.py +++ b/pyshop/views/repository.py @@ -3,6 +3,7 @@ PyShop Release File Download View. """ from pyramid.settings import asbool +import datetime from pyshop.models import DBSession, Release, ReleaseFile @@ -39,6 +40,9 @@ def show_release_file(root, request): session.add(f.release.package) session.add(f.release) session.add(f) + request.response.etag = f.md5_digest + request.response.cache_control = 'max-age=31557600, public' + request.response.date = datetime.datetime.utcnow() return rv @@ -70,4 +74,5 @@ def show_external_release_file(root, request): release.package.downloads += 1 session.add(release.package) session.add(release) + request.response.date = datetime.datetime.utcnow() return rv