A fix to avoid an error when time_expire=0 and set the proper cache_control instead.
This commit is contained in:
erbalito
2019-02-24 21:37:03 -03:00
committed by GitHub
parent afaf57f6da
commit 1779cf1a64
+6 -7
View File
@@ -600,15 +600,14 @@ class Cache(object):
(session_, vars_, lang_, user_agent_, public_) = \ (session_, vars_, lang_, user_agent_, public_) = \
(session, vars, lang, user_agent, public) (session, vars, lang, user_agent, public)
expires = 'Fri, 01 Jan 1990 00:00:00 GMT'
if time_expire: if time_expire:
cache_control = 'max-age=%(time_expire)s, s-maxage=%(time_expire)s' % dict(time_expire=time_expire) cache_control = 'max-age=%(time_expire)s, s-maxage=%(time_expire)s' % dict(time_expire=time_expire)
if not session_ and public_: expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime(
cache_control += ', public' '%a, %d %b %Y %H:%M:%S GMT')
expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire) else:
).strftime('%a, %d %b %Y %H:%M:%S GMT') cache_control = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
else: cache_control += ', public' if not session_ and public_ else ', private'
cache_control += ', private'
expires = 'Fri, 01 Jan 1990 00:00:00 GMT'
if cache_model: if cache_model:
# figure out the correct cache key # figure out the correct cache key