Skip to content

Commit

Permalink
take account of tseaver review
Browse files Browse the repository at this point in the history
  • Loading branch information
tdesvenain committed Jan 20, 2014
1 parent e4b7070 commit c302a70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion CHANGES.txt
Expand Up @@ -6,7 +6,6 @@ Changelog

- Avoid a lot of warnings when we try to RAM cache
in a context we don't have a Request.
[thomasdesvenain]

2.13.0 (2010-07-11)
-------------------
Expand Down
10 changes: 2 additions & 8 deletions src/Products/StandardCacheManagers/RAMCacheManager.py
Expand Up @@ -290,15 +290,12 @@ def ZCache_get(self, ob, view_name='', keywords=None,
'''
Gets a cache entry or returns default.
'''
if not hasattr(ob, 'REQUEST'):
return default

oc = self.getObjectCacheEntries(ob)
if oc is None:
return default
lastmod = ob.ZCacheable_getModTime(mtime_func)

index = oc.aggregateIndex(view_name, ob.REQUEST,
index = oc.aggregateIndex(view_name, getattr(ob, 'REQUEST', None),
self.request_vars, keywords)
entry = oc.getEntry(lastmod, index)
if entry is _marker:
Expand All @@ -320,9 +317,6 @@ def ZCache_set(self, ob, data, view_name='', keywords=None,
'''
Sets a cache entry.
'''
if not hasattr(ob, 'REQUEST'):
return

now = time.time()
if self.next_cleanup <= now:
self.cleanup()
Expand All @@ -332,7 +326,7 @@ def ZCache_set(self, ob, data, view_name='', keywords=None,
self.writelock.acquire()
try:
oc = self.getObjectCacheEntries(ob, create=1)
index = oc.aggregateIndex(view_name, ob.REQUEST,
index = oc.aggregateIndex(view_name, getattr(ob, 'REQUEST', None),
self.request_vars, keywords)
oc.setEntry(lastmod, index, data, view_name)
oc.misses = oc.misses + 1
Expand Down

0 comments on commit c302a70

Please sign in to comment.