Commit 53a4f048 authored by Sebastien Robin's avatar Sebastien Robin

added method getPredicatePropertyDict


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2790 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 58956b45
...@@ -350,6 +350,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -350,6 +350,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
else: else:
vars = {} vars = {}
#LOG('catalog_object vars', 0, str(vars)) #LOG('catalog_object vars', 0, str(vars))
w = IndexableObjectWrapper(vars, object) w = IndexableObjectWrapper(vars, object)
object_path = object.getPhysicalPath() object_path = object.getPhysicalPath()
...@@ -372,6 +373,9 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -372,6 +373,9 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
vars['optimised_roles_and_users'] = optimised_roles_and_users vars['optimised_roles_and_users'] = optimised_roles_and_users
else: else:
vars['optimised_roles_and_users'] = None vars['optimised_roles_and_users'] = None
predicate_property_dict = catalog.getPredicatePropertyDict(object)
if predicate_property_dict is not None:
vars['predicate_property_dict'] = predicate_property_dict
vars['security_uid'] = security_uid vars['security_uid'] = security_uid
return w return w
...@@ -386,6 +390,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -386,6 +390,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
url = self.__url(object) url = self.__url(object)
self.catalog_object(object, url, idxs=idxs, sql_catalog_id=sql_catalog_id,**kw) self.catalog_object(object, url, idxs=idxs, sql_catalog_id=sql_catalog_id,**kw)
security.declarePrivate('unindexObject') security.declarePrivate('unindexObject')
def unindexObject(self, object, path=None, sql_catalog_id=None): def unindexObject(self, object, path=None, sql_catalog_id=None):
""" """
...@@ -409,4 +414,31 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -409,4 +414,31 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
url = self.__url(object) url = self.__url(object)
self.catalog_object(object, url, idxs=idxs, is_object_moved=1) self.catalog_object(object, url, idxs=idxs, is_object_moved=1)
security.declarePublic('getPredicatePropertyDict')
def getPredicatePropertyDict(self, object):
"""
Construct a dictionnary with a list of properties
to catalog into the table predicate
"""
if getattr(object,'isPredicate',None) is None:
return None
property_dict = {}
identity_criterion = getattr(object,'_identity_criterion',None)
range_criterion = getattr(object,'_range_criterion',None)
if identity_criterion is not None:
for property, value in identity_criterion.items():
if value is not None:
property_dict[property] = value
if range_criterion is not None:
for property, (min, max) in range_criterion.items():
if min is not None:
property_dict['%s_min' % property] = min
if max is not None:
property_dict['%s_max' % property] = max
return property_dict
InitializeClass(CatalogTool) InitializeClass(CatalogTool)
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