Commit 6bc10988 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Eteri

CatalogTool: Extend "parent" support in getCategoryValueDictParameterDict

parent 8d751ead
......@@ -1091,12 +1091,36 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
)
query_list.append(category_query)
if parent_document_set is not None:
if forward:
if strict_membership:
query_list.append(SimpleQuery(
parent_uid={
document.getUid()
for document in parent_document_set
},
))
else:
query_list.append(SimpleQuery(
path={
x.getPath().replace('_', r'\_').replace('%', r'\%') + '/%'
for x in parent_document_set
},
comparison_operator='like',
))
else:
parent_uid_set = {
document.getUid()
for document in parent_document_set
}
if not strict_membership:
for document in parent_document_set:
while True:
document = document.getParentValue()
uid = getattr(document, 'getUid', lambda: None)()
if uid is None:
break
parent_uid_set.add(uid)
query_list.append(SimpleQuery(uid=parent_uid_set))
return ComplexQuery(query_list)
security.declarePublic('getCategoryParameterDict')
......
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