[Erp5-report] r25879 - in /erp5/trunk/products/ZSQLCatalog: ./ Interface/ SearchKey/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 5 14:52:19 CET 2009


Author: vincent
Date: Thu Mar  5 14:52:19 2009
New Revision: 25879

URL: http://svn.erp5.org?rev=25879&view=rev
Log:
Do not delegate join_condition query creation to RelatedKey.buildQuery.

Modified:
    erp5/trunk/products/ZSQLCatalog/Interface/ISearchKey.py
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
    erp5/trunk/products/ZSQLCatalog/SearchKey/RelatedKey.py

Modified: erp5/trunk/products/ZSQLCatalog/Interface/ISearchKey.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/Interface/ISearchKey.py?rev=25879&r1=25878&r2=25879&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/Interface/ISearchKey.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/Interface/ISearchKey.py [utf8] Thu Mar  5 14:52:19 2009
@@ -155,7 +155,7 @@
         Used to retrieve related key's ZSQLMethod.
     """
 
-  def buildQuery(sql_catalog, related_key_definition, search_value=None, search_key_name=None, logical_operator=None, comparison_operator=None):
+  def buildQuery(sql_catalog, related_key_definition, search_value=None):
     """
       group is useless here, since group is determined by ColumnMap at
       registration time. search_value becomes optional.
@@ -171,20 +171,10 @@
           Table names are separated by ','
         - a column name
         - the name of the related key ZSQLMethod
-      search_value (anything)
+      search_value (None or Query)
         If given, a condition on real column will be generated.
         Otherwise, only the SQL required to reach that column will be
         generated. This is useful when sorting on a virtual column, for
         example.
-      search_key_name (string, None)
-        If given, it overrides real column's default SearchKey.
-      logical_operator (string, None)
-        If given, expresses the default logical link between operands.
-        It must be one of None, 'or' and 'and'.
-        It is overriden by operator present in search_value if it is a dict
-        and contains an 'operator' key.
-        'or' is assumed if not given or given with a None value.
-      comparison_operator (string, None)
-        If given, expresses the comparison between column and value.
     """
 

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=25879&r1=25878&r2=25879&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Thu Mar  5 14:52:19 2009
@@ -1903,9 +1903,15 @@
         result = None
       else:
         if related_key_definition is None:
-          result = search_key.buildQuery(value, logical_operator=logical_operator, comparison_operator=comparison_operator)
+          build_key = search_key
         else:
-          result = search_key.buildQuery(search_value=value, sql_catalog=self, search_key_name=search_key_name, related_key_definition=related_key_definition, logical_operator=logical_operator, comparison_operator=comparison_operator)
+          build_key = search_key.getSearchKey(self, related_key_definition,
+                                               search_key_name=search_key_name)
+        result = build_key.buildQuery(value, logical_operator=logical_operator,
+                                      comparison_operator=comparison_operator)
+        if related_key_definition is not None:
+          result = search_key.buildQuery(self, related_key_definition,
+                                         search_value=result)
     else:
       result = script(value)
     return result

Modified: erp5/trunk/products/ZSQLCatalog/SearchKey/RelatedKey.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SearchKey/RelatedKey.py?rev=25879&r1=25878&r2=25879&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SearchKey/RelatedKey.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SearchKey/RelatedKey.py [utf8] Thu Mar  5 14:52:19 2009
@@ -38,7 +38,6 @@
 from Interface.Verify import verifyClass
 from Products.ZSQLCatalog.SQLCatalog import profiler_decorator
 
-MARKER = []
 BACKWARD_COMPATIBILITY = True
 
 class RelatedKey(SearchKey):
@@ -104,16 +103,11 @@
 
   @profiler_decorator
   def buildQuery(self, sql_catalog, related_key_definition,
-                 search_value=MARKER, search_key_name=None,
-                 logical_operator=None, comparison_operator=None):
+                 search_value=None):
     self._buildRelatedKey(related_key_definition)
-    if search_value is MARKER:
-      join_condition = None
-    else:
-      join_condition = self._getSearchKey(sql_catalog, search_key_name).buildQuery(
-        search_value, group=self.getColumn(),
-        logical_operator=logical_operator,
-        comparison_operator=comparison_operator)
+    if isinstance(search_value, Query):
+      search_value.setGroup(self.getColumn())
+    join_condition = search_value
     return RelatedQuery(search_key=self,
                         join_condition=join_condition)
 




More information about the Erp5-report mailing list