[Erp5-report] r39181 kazuhiko - /erp5/trunk/products/ERP5/mixin/cached_convertable.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 14 17:04:36 CEST 2010


Author: kazuhiko
Date: Thu Oct 14 17:04:35 2010
New Revision: 39181

URL: http://svn.erp5.org?rev=39181&view=rev
Log:
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.

Modified:
    erp5/trunk/products/ERP5/mixin/cached_convertable.py

Modified: erp5/trunk/products/ERP5/mixin/cached_convertable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/cached_convertable.py?rev=39181&r1=39180&r2=39181&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] Thu Oct 14 17:04:35 2010
@@ -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()




More information about the Erp5-report mailing list