Skip to content

Commit

Permalink
Manual tweaks to get better formatting out of black
Browse files Browse the repository at this point in the history
  • Loading branch information
dstufft committed Apr 20, 2018
1 parent 96cc04a commit 3cfc497
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion tests/unit/i18n/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def test_includeme():
"jinja2.filters": {
"format_date": "warehouse.i18n.filters:format_date",
"format_datetime": "warehouse.i18n.filters:format_datetime",
"format_rfc822_datetime": "warehouse.i18n.filters:format_rfc822_datetime",
"format_rfc822_datetime": (
"warehouse.i18n.filters:format_rfc822_datetime"
),
"format_number": "warehouse.i18n.filters:format_number",
}
}
Expand Down
18 changes: 10 additions & 8 deletions warehouse/cache/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ def wrapped(context, request):
response = view(context, request)

if not request.registry.settings.get("pyramid.prevent_http_cache", False):
cache_control = response.cache_control

if seconds:
if public:
response.cache_control.public = True
cache_control.public = True
else:
response.cache_control.private = True
cache_control.private = True

response.cache_control.stale_while_revalidate = stale_while_revalidate
response.cache_control.stale_if_error = stale_if_error
response.cache_control.max_age = seconds
cache_control.stale_while_revalidate = stale_while_revalidate
cache_control.stale_if_error = stale_if_error
cache_control.max_age = seconds
else:
response.cache_control.no_cache = True
response.cache_control.no_store = True
response.cache_control.must_revalidate = True
cache_control.no_cache = True
cache_control.no_store = True
cache_control.must_revalidate = True

return response

Expand Down

0 comments on commit 3cfc497

Please sign in to comment.