From 932c889de4212e0f374b8a4455d322fb0ca6f398 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Tue, 10 Mar 2009 15:33:18 +0000 Subject: [PATCH] Instead of computing SearchText representation from internal comparison operator representation, use a dict. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25948 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZSQLCatalog/Query/ComplexQuery.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/product/ZSQLCatalog/Query/ComplexQuery.py b/product/ZSQLCatalog/Query/ComplexQuery.py index d817be737d..85922cc4ad 100644 --- a/product/ZSQLCatalog/Query/ComplexQuery.py +++ b/product/ZSQLCatalog/Query/ComplexQuery.py @@ -35,6 +35,11 @@ from Products.ZSQLCatalog.Interface.IQuery import IQuery from Interface.Verify import verifyClass from Products.ZSQLCatalog.SQLCatalog import profiler_decorator +logical_operator_search_text_dict = { + 'and': 'AND', + 'or': 'OR', +} + class ComplexQuery(Query): """ A ComplexQuery represents logical operations between Query instances. @@ -97,11 +102,11 @@ class ComplexQuery(Query): if len(search_text_list) == 0: result = '' else: - if self.logical_operator in ('and', 'or'): + if self.logical_operator in logical_operator_search_text_dict: if len(search_text_list) == 1: result = search_text_list[0] else: - logical_operator = ' %s ' % (self.logical_operator.upper(), ) + logical_operator = ' %s ' % (logical_operator_search_text_dict[self.logical_operator], ) result = '(%s)' % (logical_operator.join(search_text_list), ) elif self.logical_operator == 'not': assert len(search_text_list) == 1 -- 2.30.9