Commit a5ce091b authored by Nicolas Delaby's avatar Nicolas Delaby

get rid of CachingMethod, replace them by decorator for consistency.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36144 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 86d24025
......@@ -941,12 +941,13 @@ class Catalog(Folder,
return catalog_schema_dict[table]
@caching_instance_method(id='SQLCatalog.getColumnIds',
cache_factory='erp5_content_long')
def getColumnIds(self):
"""
Calls the show column method and returns dictionnary of
Field Ids
"""
def _getColumnIds():
keys = {}
for table in self.getCatalogSearchTableIds():
field_list = self._getCatalogSchema(table=table)
......@@ -961,10 +962,9 @@ class Catalog(Folder,
scriptable_tuple = scriptable.split('|')
scriptable = scriptable_tuple[0].strip()
keys[scriptable] = None
keys = keys.keys()
keys = list(keys.keys())
keys.sort()
return keys
return CachingMethod(_getColumnIds, id='SQLCatalog.getColumnIds', cache_factory='erp5_content_long')()[:]
@profiler_decorator
@transactional_cache_decorator('SQLCatalog.getColumnMap')
......@@ -1815,11 +1815,12 @@ class Catalog(Folder,
"""
return self.sql_catalog_scriptable_keys
@caching_instance_method(id='SQLCatalog.getTableIndex',
cache_factory='erp5_content_long')
def getTableIndex(self, table):
"""
Return a map between index and column for a given table
"""
def _getTableIndex(table):
table_index = {}
method = getattr(self, self.sql_catalog_index, '')
if method in ('', None):
......@@ -1830,9 +1831,7 @@ class Catalog(Folder,
table_index[line.KEY_NAME].append(line.COLUMN_NAME)
else:
table_index[line.KEY_NAME] = [line.COLUMN_NAME,]
return table_index
return CachingMethod(_getTableIndex, id='SQLCatalog.getTableIndex', \
cache_factory='erp5_content_long')(table=table).copy()
return table_index.copy()
@profiler_decorator
def isValidColumn(self, column_id):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment