Commit bb49d24a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

AcceleratedHTTPCacheManager: do nothing if object is not directly published.

If we accidentally specify AcceleratedHTTPCacheManager in a widely-called Script (Python) by mistake, many responses will have wrong Cache-Control header.
With this change, AcceleratedHTTPCacheManager is effective only when the object itself is directly published, so that we can prevent such unexpected cache pollution.
parent fdb0f6c9
...@@ -12,6 +12,10 @@ def ZCache_set(self, ob, data, view_name, keywords, mtime_func): ...@@ -12,6 +12,10 @@ def ZCache_set(self, ob, data, view_name, keywords, mtime_func):
# data. mtime_func is also ignored because using "now" for # data. mtime_func is also ignored because using "now" for
# Last-Modified is as good as using any time in the past. # Last-Modified is as good as using any time in the past.
REQUEST = ob.REQUEST REQUEST = ob.REQUEST
# Do nothing if ob is not directly published.
published = REQUEST.get('PUBLISHED')
if getattr(published, '__self__', published) != ob:
return
RESPONSE = REQUEST.RESPONSE RESPONSE = REQUEST.RESPONSE
anon = 1 anon = 1
u = REQUEST.get('AUTHENTICATED_USER', None) u = REQUEST.get('AUTHENTICATED_USER', None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment