[Erp5-report] r37184 vincent - /erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jul 19 11:32:59 CEST 2010


Author: vincent
Date: Mon Jul 19 11:32:59 2010
New Revision: 37184

URL: http://svn.erp5.org?rev=37184&view=rev
Log:
Factorise code a tiny bit.

This prepares for more invasive changes about cache_id computation.

Modified:
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=37184&r1=37183&r2=37184&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Mon Jul 19 11:32:59 2010
@@ -112,11 +112,12 @@ class transactional_cache_decorator:
   def __call__(self, method):
     def wrapper(wrapped_self):
       transactional_cache = getTransactionalVariable(None)
+      cache_id = self.cache_id
       try:
-        return transactional_cache[self.cache_id]
+        result = transactional_cache[cache_id]
       except KeyError:
-        result = transactional_cache[self.cache_id] = method(wrapped_self)
-        return result
+        result = transactional_cache[cache_id] = method(wrapped_self)
+      return result
     return wrapper
 
 try:




More information about the Erp5-report mailing list