From 21a035f4b7a899080e1b346d82a662573bdad780 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Fri, 16 Mar 2007 09:47:49 +0000 Subject: [PATCH] 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 --- product/CMFCategory/CategoryTool.py | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/product/CMFCategory/CategoryTool.py b/product/CMFCategory/CategoryTool.py index c99f80f53d..7749e56049 100644 --- a/product/CMFCategory/CategoryTool.py +++ b/product/CMFCategory/CategoryTool.py @@ -42,7 +42,6 @@ from Products.CMFCategory import _dtmldir from Products.CMFCore.PortalFolder import ContentFilter from Products.CMFCategory.Renderer import Renderer from OFS.Traversable import NotFound -from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery import re @@ -1296,22 +1295,22 @@ class CategoryTool( UniqueObject, Folder, Base ): for base_category in base_category_list: category_list.append("%s/%s" % (base_category, context.getRelativeUrl())) - if portal_type is not None: - portal_type_query = Query(portal_type=portal_type) - if query is None: - query = portal_type_query - else: - query = ComplexQuery(query, portal_type_query, operator='AND') - - # XXX Is Base_zSearchRelatedObjectsByCategoryList still usefull ? - # It may possible to call portal catalog directly - # Base_zSearchRelatedObjectsByCategoryList add a dependency to ERP5 - query = self.portal_catalog.buildSQLQuery(query=query) - brain_result = self.Base_zSearchRelatedObjectsByCategoryList( - category_list=category_list, - strict_membership=strict_membership, - where_expression=query['where_expression'], - order_by_expression=query['order_by_expression'],) + if query is not None: + query = self.portal_catalog.buildSQLQuery(query=query) + # XXX Is Base_zSearchRelatedObjectsByCategoryList still usefull ? + # It may possible to call portal catalog directly + # Base_zSearchRelatedObjectsByCategoryList add a dependency to ERP5 + brain_result = self.Base_zSearchRelatedObjectsByCategoryList( + category_list=category_list, + portal_type=portal_type, + strict_membership=strict_membership, + where_expression=query['where_expression'], + order_by_expression=query['order_by_expression'],) + else: + brain_result = self.Base_zSearchRelatedObjectsByCategoryList( + category_list=category_list, + portal_type=portal_type, + strict_membership=strict_membership) result = [] for b in brain_result: -- 2.30.9