Commit 57463f30 authored by Vincent Pelletier's avatar Vincent Pelletier

Products.ERP5Type.Core.Predicate: Obey isEmptyCriterionValid .

When EmptyCriterionValid property is true, this method is expected to
return a query which does not match any document. This only happens when
query_list is empty, but because of category membership checking,
query_list is never empty: it at least contains two ComplexQueries which
themselves may contain an empty query list, and which match all documents.
Calling getCategoryParameterDict with an empty list is dubious, but
changing its behaviour in ZSQLCatalog may affect more than just predicates,
so change the behaviour in Predicate class directly by checking whether
there is any category being matched to begin with.
parent 9f4dde50
Pipeline #19516 failed with stage
in 0 seconds
...@@ -246,13 +246,18 @@ class Predicate(XMLObject): ...@@ -246,13 +246,18 @@ class Predicate(XMLObject):
self.getMembershipCriterionCategoryList, self.getMembershipCriterionCategoryList,
), ),
): ):
append( filtered_category_list = filterCategoryList(
getCategoryParameterDict( getBaseCategorySet(),
filterCategoryList(getBaseCategorySet(), getCategoryList()), getCategoryList(),
strict_membership=strict_membership,
onMissing=lambda category: False,
),
) )
if filtered_category_list:
append(
getCategoryParameterDict(
filtered_category_list,
strict_membership=strict_membership,
onMissing=lambda category: False,
),
)
# Value criterion # Value criterion
for criterion in self.getCriterionList(): for criterion in self.getCriterionList():
......
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