mirror of
https://github.com/Hopiu/django.git
synced 2026-04-19 14:31:09 +00:00
Simplified django.utils.cache.get_max_age().
This commit is contained in:
parent
bee4c2baed
commit
3d94ee8500
1 changed files with 4 additions and 5 deletions
|
|
@ -93,11 +93,10 @@ def get_max_age(response):
|
|||
if not response.has_header('Cache-Control'):
|
||||
return
|
||||
cc = dict(_to_tuple(el) for el in cc_delim_re.split(response['Cache-Control']))
|
||||
if 'max-age' in cc:
|
||||
try:
|
||||
return int(cc['max-age'])
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
try:
|
||||
return int(cc['max-age'])
|
||||
except (ValueError, TypeError, KeyError):
|
||||
pass
|
||||
|
||||
|
||||
def set_response_etag(response):
|
||||
|
|
|
|||
Loading…
Reference in a new issue