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

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Dec 17 11:49:10 CET 2008


Author: vincent
Date: Wed Dec 17 11:49:10 2008
New Revision: 24917

URL: http://svn.erp5.org?rev=24917&view=rev
Log:
As we return cached version of those values, copy them upon return. This prevents third-party code from "poisoning" the cache.

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=24917&r1=24916&r2=24917&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Wed Dec 17 11:49:10 2008
@@ -887,7 +887,7 @@
       keys = keys.keys()
       keys.sort()
       return keys
-    return CachingMethod(_getColumnIds, id='SQLCatalog.getColumnIds', cache_factory='erp5_content_long')()
+    return CachingMethod(_getColumnIds, id='SQLCatalog.getColumnIds', cache_factory='erp5_content_long')().copy()
 
   def getColumnMap(self):
     """
@@ -906,7 +906,7 @@
           if not keys.has_key(key): keys[key] = []
           keys[key].append(table) # Is this inconsistent ?
       return keys
-    return CachingMethod(_getColumnMap, id='SQLCatalog.getColumnMap', cache_factory='erp5_content_long')()
+    return CachingMethod(_getColumnMap, id='SQLCatalog.getColumnMap', cache_factory='erp5_content_long')().copy()
 
   def getResultColumnIds(self):
     """
@@ -1708,7 +1708,7 @@
           %(table_index, table))
       return table_index
     return CachingMethod(_getTableIndex, id='SQLCatalog.getTableIndex', \
-                         cache_factory='erp5_content_long')(table=table)
+                         cache_factory='erp5_content_long')(table=table)[:]
 
 
   def getIndex(self, table, column_list, all_column_list):
@@ -1742,7 +1742,7 @@
           %(possible_index, table, column_list))
       return possible_index
     return CachingMethod(_getIndex, id='SQLCatalog.getIndex', cache_factory='erp5_content_long')\
-          (table=table, column_list=column_list, all_column_list=all_column_list)
+          (table=table, column_list=column_list, all_column_list=all_column_list)[:]
 
 
   def buildSQLQuery(self, query_table='catalog', REQUEST=None,




More information about the Erp5-report mailing list