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

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


Author: vincent
Date: Mon Jul 19 11:32:09 2010
New Revision: 37183

URL: http://svn.erp5.org?rev=37183&view=rev
Log:
Remove use of volatile attribute.

Code calling this method in this class already cache their own result,
and it is not part of the API (so it should not be directly accessed).

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=37183&r1=37182&r2=37183&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Mon Jul 19 11:32:09 2010
@@ -814,10 +814,6 @@ class Catalog(Folder,
       # Add a dummy item so that SQLCatalog will not use existing uids again.
       self.insertMaxUid()
 
-    # Remove the cache of catalog schema.
-    if hasattr(self, '_v_catalog_schema_dict') :
-      del self._v_catalog_schema_dict
-
     self._clearSecurityCache()
 
   def insertMaxUid(self):
@@ -909,28 +905,19 @@ class Catalog(Folder,
     return self.sql_search_result_keys
 
   def _getCatalogSchema(self, table=None):
-    # XXX: Using a volatile as a cache makes it impossible to flush
-    # consistently on all connections containing the volatile. Another
-    # caching scheme must be used here.
-    catalog_schema_dict = getattr(aq_base(self), '_v_catalog_schema_dict', {})
-
-    if table not in catalog_schema_dict:
-      result_list = []
-      try:
-        method_name = self.sql_catalog_schema
-        method = getattr(self, method_name)
-        search_result = method(table=table)
-        for c in search_result:
-          result_list.append(c.Field)
-      except ConflictError:
-        raise
-      except:
-        LOG('SQLCatalog', WARNING, '_getCatalogSchema failed with the method %s' % method_name, error=sys.exc_info())
-        pass
-      catalog_schema_dict[table] = tuple(result_list)
-      self._v_catalog_schema_dict= catalog_schema_dict
-
-    return catalog_schema_dict[table]
+    result_list = []
+    try:
+      method_name = self.sql_catalog_schema
+      method = getattr(self, method_name)
+      search_result = method(table=table)
+      for c in search_result:
+        result_list.append(c.Field)
+    except ConflictError:
+      raise
+    except:
+      LOG('SQLCatalog', WARNING, '_getCatalogSchema failed with the method %s' % method_name, error=sys.exc_info())
+      pass
+    return tuple(result_list)
 
   @caching_instance_method(id='SQLCatalog.getColumnIds',
                            cache_factory='erp5_content_long')




More information about the Erp5-report mailing list