[Erp5-report] r38248 kazuhiko - in /erp5/trunk/products/ERP5Form: ./ Tool/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 9 23:02:01 CEST 2010


Author: kazuhiko
Date: Thu Sep  9 23:02:01 2010
New Revision: 38248

URL: http://svn.erp5.org?rev=38248&view=rev
Log:
support an empty selection_name, that means we do not store the selection.

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

Modified: erp5/trunk/products/ERP5Form/ListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ListBox.py?rev=38248&r1=38247&r2=38248&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ListBox.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/ListBox.py [utf8] Thu Sep  9 23:02:01 2010
@@ -267,7 +267,7 @@ class ListBoxWidget(Widget.Widget):
                                  description=('The name of the selection to '
                                               'store selection parameters'),
                                  default='',
-                                 required=1)
+                                 required=0)
     property_names.append('selection_name')
 
     meta_types = fields.ListTextAreaField('meta_types',
@@ -2425,13 +2425,16 @@ class ListBoxHTMLRendererLine(ListBoxRen
                 error = sys.exc_info())
         else:
           try:
-            url = '%s/view?selection_index=%s&selection_name=%s&ignore_layout:int=%s&reset:int=1' % (
+            url = '%s/view?ignore_layout:int=%s&reset:int=1' % (
                       # brain.absolute_url() is slow because it invokes
                       # _aq_dynamic() every time to get brain.REQUEST,
                       # so we call request.physicalPathToURL() directly
                       # instead of brain.absolute_url().
                       request.physicalPathToURL(brain.getPath()),
-                      self.index, selection_name, ignore_layout)
+                      ignore_layout)
+            if selection_name:
+              url += '&selection_index=%s&selection_name=%s' % (
+                self.index, selection_name)
           except AttributeError:
             pass
 

Modified: erp5/trunk/products/ERP5Form/Tool/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Tool/SelectionTool.py?rev=38248&r1=38247&r2=38248&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] Thu Sep  9 23:02:01 2010
@@ -251,6 +251,8 @@ class SelectionTool( BaseTool, SimpleIte
       """
       if isinstance(selection_name, (tuple, list)):
         selection_name = selection_name[0]
+      if not selection_name:
+        return None
       selection = self._getSelectionFromContainer(selection_name)
       if selection is not None:
         return selection.__of__(self)
@@ -263,6 +265,8 @@ class SelectionTool( BaseTool, SimpleIte
       """
         Sets the selection instance for a given selection_name
       """
+      if not selection_name:
+        return
       if selection_object != None:
         # Set the name so that this selection itself can get its own name.
         selection_object.edit(name=selection_name)




More information about the Erp5-report mailing list