Commit 623948a1 authored by Vincent Pelletier's avatar Vincent Pelletier

Avoid the obverhead of creating a new Query and ComplexQuery where result can be predicted.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15336 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent beebc76b
...@@ -495,6 +495,10 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -495,6 +495,10 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
query_list.append(new_query) query_list.append(new_query)
operator_kw = {'operator': 'AND'} operator_kw = {'operator': 'AND'}
query = ComplexQuery(*query_list, **operator_kw) query = ComplexQuery(*query_list, **operator_kw)
# If security_uid_list is empty, adding it to criterions will only
# result in "false or [...]", so avoid useless overhead by not
# adding it at all.
if security_uid_list:
query = ComplexQuery(Query(security_uid=security_uid_list, operator='IN'), query = ComplexQuery(Query(security_uid=security_uid_list, operator='IN'),
query, operator='OR') query, operator='OR')
else: else:
......
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