[Erp5-report] r25945 - in /erp5/trunk/products/ZSQLCatalog: ./ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 10 15:49:04 CET 2009


Author: vincent
Date: Tue Mar 10 15:49:03 2009
New Revision: 25945

URL: http://svn.erp5.org?rev=25945&view=rev
Log:
Fix SearchText parsing: it was not passing desired logical_operator to buildQuery, causing AND to becore OR (only for logical operator syntax tree node directly containing leaf nodes).

Modified:
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
    erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=25945&r1=25944&r2=25945&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Tue Mar 10 15:49:03 2009
@@ -1935,9 +1935,9 @@
           subquery = self._buildQueryFromAbstractSyntaxTreeNode(subnode, search_key)
           if subquery is not None:
             append(subquery)
+      operator = node.getLogicalOperator()
       for comparison_operator, value_list in value_dict.iteritems():
-        append(search_key.buildQuery(value_list, comparison_operator=comparison_operator))
-      operator = node.getLogicalOperator()
+        append(search_key.buildQuery(value_list, comparison_operator=comparison_operator, logical_operator=operator))
       if operator == 'not' or len(query_list) > 1:
         result = ComplexQuery(query_list, operator=operator)
       elif len(query_list) == 1:

Modified: erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py?rev=25945&r1=25944&r2=25945&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/tests/testSQLCatalog.py [utf8] Tue Mar 10 15:49:03 2009
@@ -299,6 +299,10 @@
                  {column: '%a'})
     self.catalog(ReferenceQuery(ReferenceQuery(operator='<', keyword='a'), operator='and'),
                  {column: '<a'})
+    self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='like', keyword='%a%'), ReferenceQuery(operator='like', keyword='%b%'), operator='and'), operator='and'),
+                 {column: 'a AND b'})
+    self.catalog(ReferenceQuery(ReferenceQuery(ReferenceQuery(operator='like', keyword='%a%'), ReferenceQuery(operator='like', keyword='%b%'), operator='or'), operator='and'),
+                 {column: 'a OR b'})
     self.catalog(ReferenceQuery(ReferenceQuery(operator='<', keyword='path'), operator='and'),
                  {column: {'query': 'path', 'range': 'max'}})
     self.catalog(ReferenceQuery(ReferenceQuery(




More information about the Erp5-report mailing list