Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #84 from EasyPost/md5
Browse files Browse the repository at this point in the history
Fix caching under pip 9
mardiros authored Aug 8, 2017
2 parents 1d06898 + 6da4a29 commit 8a4a774
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyshop/templates/pyshop/simple/show.html
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
{%- endif -%}
{%- else -%}
<a href="{{ route_url('show_release_file', file_id=f.id, filename=f.filename)
}}#{{ f.md5_digest }}">{{f.filename}}</a><br/>
}}#md5={{ f.md5_digest }}">{{f.filename}}</a><br/>
{% endif -%}
{% endfor -%}
{% if not r.files %}
@@ -24,4 +24,4 @@
{% endif %}
{% endif %}
{% endfor %}
</body></html>{% else %}Not found, ({{package_name}} does not have any release){% endif %}
</body></html>{% else %}Not found, ({{package_name}} does not have any release){% endif %}
5 changes: 5 additions & 0 deletions pyshop/views/repository.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8a4a774

Please sign in to comment.