Commit 0e2178f9 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

since r38650, isTempObject() returns True for asContext() result, so now the...

since r38650, isTempObject() returns True for asContext() result, so now the condition to switch cache storage is not isTempObject() result but getOriginalDocument() result. this change will solve recent failures of testERP5Web.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39181 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 760fa111
......@@ -74,8 +74,8 @@ class CachedConvertableMixin:
def _getCacheFactory(self):
"""
"""
if self.isTempObject():
return
if self.getOriginalDocument() is None:
return None
cache_tool = getToolByName(self, 'portal_caches')
preference_tool = getToolByName(self, 'portal_preferences')
cache_factory_name = preference_tool.getPreferredConversionCacheFactory('document_cache_factory')
......@@ -148,12 +148,12 @@ class CachedConvertableMixin:
'data': cached_value,
'date': date,
'size': size}
if self.isTempObject():
cache_factory = self._getCacheFactory()
if cache_factory is None:
if getattr(aq_base(self), 'temp_conversion_data', None) is None:
self.temp_conversion_data = {}
self.temp_conversion_data[cache_id] = stored_data_dict
return
cache_factory = self._getCacheFactory()
cache_duration = cache_factory.cache_duration
# The purpose of this transaction cache is to help calls
# to the same cache value in the same transaction.
......@@ -168,7 +168,8 @@ class CachedConvertableMixin:
"""
"""
cache_id = self._getCacheKey(**kw)
if self.isTempObject():
cache_factory = self._getCacheFactory()
if cache_factory is None:
return getattr(aq_base(self), 'temp_conversion_data', {})[cache_id]
# The purpose of this cache is to help calls to the same cache value
# in the same transaction.
......@@ -177,7 +178,7 @@ class CachedConvertableMixin:
return tv[cache_id]
except KeyError:
pass
for cache_plugin in self._getCacheFactory().getCachePluginList():
for cache_plugin in cache_factory.getCachePluginList():
cache_entry = cache_plugin.get(cache_id, DEFAULT_CACHE_SCOPE)
if cache_entry is not None:
data_dict = cache_entry.getValue()
......
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