[Erp5-report] r27687 - /erp5/trunk/products/ERP5Form/SelectionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 19 15:17:43 CEST 2009


Author: vincent
Date: Fri Jun 19 15:17:42 2009
New Revision: 27687

URL: http://svn.erp5.org?rev=27687&view=rev
Log:
Use SQLCatalog to generate a SearchTextExpression.
Do not define a special case when there is exactly one line in the relation string field, to make sure the SearchTextExpression is valid even in this case.

Modified:
    erp5/trunk/products/ERP5Form/SelectionTool.py

Modified: erp5/trunk/products/ERP5Form/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/SelectionTool.py?rev=27687&r1=27686&r2=27687&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/SelectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/SelectionTool.py [utf8] Fri Jun 19 15:17:42 2009
@@ -1143,19 +1143,19 @@
                                   field.get_value('portal_type')])
           # Checked current uid
           kw ={}
-          kw[field.get_value('catalog_index')] = field_value
+          catalog_index = field.get_value('catalog_index')
+          kw[catalog_index] = field_value
           self.setSelectionParamsFor(selection_name,
                                      kw.copy())
           self.setSelectionCheckedUidsFor(selection_name,
                                           current_uid_list)
-          field_value = str(field_value).splitlines()
-          # Prevent displaying useless empty list or list with only one element
-          if not field_value:
-            field_value = ''
-          if len(field_value) == 1:
-            field_value = field_value[0]
-          if len(field_value) > 1 and isinstance(field_value, type([])):
-            field_value = ' OR '.join(field_value)
+          field_value = str(field_value)
+          if len(field_value):
+            sql_catalog = self.portal_catalog.getSQLCatalog()
+            field_value = sql_catalog.buildQuery({
+              catalog_index: field_value.splitlines()
+            }).asSearchTextExpression(sql_catalog, column='')
+
           REQUEST.form[field_key] = field_value
           portal_status_message = translateString("Please select one (or more) object.")
         else:




More information about the Erp5-report mailing list