[Erp5-report] r23136 - /erp5/trunk/products/ERP5Type/Cache.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Aug 25 09:00:20 CEST 2008
Author: vincent
Date: Mon Aug 25 09:00:20 2008
New Revision: 23136
URL: http://svn.erp5.org?rev=23136&view=rev
Log:
Prevent cache system from hiding KeyErrors in invoked methods. It must only handle the cas of missing cache factory.
Modified:
erp5/trunk/products/ERP5Type/Cache.py
Modified: erp5/trunk/products/ERP5Type/Cache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Cache.py?rev=23136&r1=23135&r2=23136&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py (original)
+++ erp5/trunk/products/ERP5Type/Cache.py Mon Aug 25 09:00:20 2008
@@ -189,9 +189,7 @@
## which is faster than checking for keys
# It is very important to take the factories dictionnary
# on CachingMethod instead of self, we want a global variable
- value = CachingMethod.factories[self.cache_factory](
- self.callable_object, cache_id, scope, self.cache_duration,
- *args, **kwd)
+ cache_factory = CachingMethod.factories[self.cache_factory]
except KeyError:
global is_cache_ready
if is_cache_ready:
@@ -200,6 +198,10 @@
"Factory %s not found, method %s executed without cache" % (
self.cache_factory, self.callable_object))
value = self.callable_object(*args, **kwd)
+ else:
+ value = cache_factory(
+ self.callable_object, cache_id, scope, self.cache_duration,
+ *args, **kwd)
return value
def delete(self, id, cache_factory=DEFAULT_CACHE_FACTORY, scope=DEFAULT_CACHE_SCOPE):
More information about the Erp5-report
mailing list