fixed possible problem with cache.action

This commit is contained in:
mdipierro committed 2015-10-16 21:39:30 -05:00
1 parent bbed326c20
commit 4de007a946
1 file changed
+7 -3
+7 -3
View File
@@ -606,8 +606,7 @@ class Cache(object):
def wrapped_f(): def wrapped_f():
if current.request.env.request_method != 'GET': if current.request.env.request_method != 'GET':
return func() return func()
if time_expire:
cache_control = 'max-age=%(time_expire)s, s-maxage=%(time_expire)s' % dict(time_expire=time_expire)
if quick: if quick:
session_ = True if 'S' in quick else False session_ = True if 'S' in quick else False
vars_ = True if 'V' in quick else False vars_ = True if 'V' in quick else False
@@ -615,13 +614,18 @@ class Cache(object):
user_agent_ = True if 'U' in quick else False user_agent_ = True if 'U' in quick else False
public_ = True if 'P' in quick else False public_ = True if 'P' in quick else False
else: else:
session_, vars_, lang_, user_agent_, public_ = session, vars, lang, user_agent, public (session_, vars_, lang_, user_agent_, public_) = \
(session, vars, lang, user_agent, public)
if time_expire:
cache_control = 'max-age=%(time_expire)s, s-maxage=%(time_expire)s' % dict(time_expire=time_expire)
if not session_ and public_: if not session_ and public_:
cache_control += ', public' cache_control += ', public'
expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT') expires = (current.request.utcnow + datetime.timedelta(seconds=time_expire)).strftime('%a, %d %b %Y %H:%M:%S GMT')
else: else:
cache_control += ', private' cache_control += ', private'
expires = 'Fri, 01 Jan 1990 00:00:00 GMT' 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
cache_key = [current.request.env.path_info, current.response.view] cache_key = [current.request.env.path_info, current.response.view]