Commit a8cc22a7 authored by Fabien Morin's avatar Fabien Morin

make possible to filter searhResults results (useful to filter by portal_types

in listboxes for example)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35565 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent db89715c
......@@ -235,7 +235,20 @@ class Predicate(XMLObject):
'range' : 'max'
}
else:
catalog_kw[criterion.property] = criterion.identity
# if a filter was passed as argument
if catalog_kw.has_key(criterion.property):
if isinstance(catalog_kw[criterion.property], (tuple, list)):
catalog_filter_set = set(catalog_kw[criterion.property])
else:
catalog_filter_set = set([catalog_kw[criterion.property]])
if isinstance(criterion.identity, (tuple, list)):
parameter_filter_set = set(criterion.identity)
else:
parameter_filter_set = set([criterion.identity])
catalog_kw[criterion.property] = \
list(catalog_filter_set.intersection(parameter_filter_set))
else:
catalog_kw[criterion.property] = criterion.identity
portal_catalog = getToolByName(self, 'portal_catalog')
......
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