Commit e4af1224 authored by Sebastien Robin's avatar Sebastien Robin

added support for dynamic keys

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6575 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7c4c6ee7
...@@ -1337,6 +1337,16 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1337,6 +1337,16 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
value = sql_quote(str(value)) value = sql_quote(str(value))
return value return value
def getSqlCatalogRelatedKeyList(self, **kw):
"""
Return the list of related keys.
This method can be overidden in order to implement
dynamic generation of some related keys.
"""
dynamic_list = self.getDynamicRelatedKeyList(**kw)
full_list = list(dynamic_list) + list(self.sql_catalog_related_keys)
return full_list
def buildSQLQuery(self, query_table='catalog', REQUEST=None, def buildSQLQuery(self, query_table='catalog', REQUEST=None,
ignore_empty_string=1,**kw): ignore_empty_string=1,**kw):
""" Builds a complex SQL query to simulate ZCalatog behaviour """ """ Builds a complex SQL query to simulate ZCalatog behaviour """
...@@ -1361,7 +1371,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1361,7 +1371,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
# Define related maps # Define related maps
# each tuple has the form (key, 'table1,table2,table3/column/where_expression') # each tuple has the form (key, 'table1,table2,table3/column/where_expression')
related_tuples = self.sql_catalog_related_keys related_tuples = self.getSqlCatalogRelatedKeyList(**kw)
#LOG('related_tuples', 0, str(related_tuples)) #LOG('related_tuples', 0, str(related_tuples))
related_keys = [] related_keys = []
related_method = {} related_method = {}
......
...@@ -580,6 +580,12 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -580,6 +580,12 @@ class ZCatalog(Folder, Persistent, Implicit):
if catalog is not None: if catalog is not None:
return catalog.newUid() return catalog.newUid()
def getDynamicRelatedKeyList(self, sql_catalog_id=None,**kw):
"""
Return the list of dynamic related keys.
"""
return []
def wrapObject(self, object, **kw): def wrapObject(self, object, **kw):
""" """
Return a wrapped object for reindexing. Return a wrapped object for reindexing.
......
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