Commit 21a035f4 authored by Romain Courteaud's avatar Romain Courteaud

Calling buildSQLQuery is slower than using a parameter to the ZSLMethod, so

portal_type parameter is restored.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13449 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bb11d071
...@@ -42,7 +42,6 @@ from Products.CMFCategory import _dtmldir ...@@ -42,7 +42,6 @@ from Products.CMFCategory import _dtmldir
from Products.CMFCore.PortalFolder import ContentFilter from Products.CMFCore.PortalFolder import ContentFilter
from Products.CMFCategory.Renderer import Renderer from Products.CMFCategory.Renderer import Renderer
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
import re import re
...@@ -1296,22 +1295,22 @@ class CategoryTool( UniqueObject, Folder, Base ): ...@@ -1296,22 +1295,22 @@ class CategoryTool( UniqueObject, Folder, Base ):
for base_category in base_category_list: for base_category in base_category_list:
category_list.append("%s/%s" % (base_category, context.getRelativeUrl())) category_list.append("%s/%s" % (base_category, context.getRelativeUrl()))
if portal_type is not None: if query is not None:
portal_type_query = Query(portal_type=portal_type) query = self.portal_catalog.buildSQLQuery(query=query)
if query is None: # XXX Is Base_zSearchRelatedObjectsByCategoryList still usefull ?
query = portal_type_query # It may possible to call portal catalog directly
else: # Base_zSearchRelatedObjectsByCategoryList add a dependency to ERP5
query = ComplexQuery(query, portal_type_query, operator='AND') brain_result = self.Base_zSearchRelatedObjectsByCategoryList(
category_list=category_list,
# XXX Is Base_zSearchRelatedObjectsByCategoryList still usefull ? portal_type=portal_type,
# It may possible to call portal catalog directly strict_membership=strict_membership,
# Base_zSearchRelatedObjectsByCategoryList add a dependency to ERP5 where_expression=query['where_expression'],
query = self.portal_catalog.buildSQLQuery(query=query) order_by_expression=query['order_by_expression'],)
brain_result = self.Base_zSearchRelatedObjectsByCategoryList( else:
category_list=category_list, brain_result = self.Base_zSearchRelatedObjectsByCategoryList(
strict_membership=strict_membership, category_list=category_list,
where_expression=query['where_expression'], portal_type=portal_type,
order_by_expression=query['order_by_expression'],) strict_membership=strict_membership)
result = [] result = []
for b in brain_result: for b in brain_result:
......
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