[Erp5-report] r21999 - in /erp5/trunk/products/ERP5Form: ListBox.py SelectionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 27 11:29:00 CEST 2008


Author: vincent
Date: Fri Jun 27 11:28:52 2008
New Revision: 21999

URL: http://svn.erp5.org?rev=21999&view=rev
Log:
Unify page changes (next/previous/set) in listbox: make selection tool update the selection.
Remove parameter from request as it has been handled. This is needed because when there will be multiple listboxes on the same page with their subfields prefixed, updating the selection would not know which prefix to use, and would overwrite the value computed from selection tool with bare transmited value.
Not updating first/last variants since they are broken.

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

Modified: erp5/trunk/products/ERP5Form/ListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ListBox.py?rev=21999&r1=21998&r2=21999&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ListBox.py (original)
+++ erp5/trunk/products/ERP5Form/ListBox.py Fri Jun 27 11:28:52 2008
@@ -2213,18 +2213,7 @@
   def getLineStart(self):
     """Return a requested start number.
     """
-    try:
-      start = self.request.get('list_start')
-      start = int(start)
-    except (TypeError, KeyError):
-      param_dict = self.getParamDict()
-      start = param_dict.get('list_start', 0)
-      if isinstance(start, list):
-        start = start[0]
-      start = int(start)
-    start = max(start, 0)
-
-    return start
+    return int(self.getParamDict().get('list_start', 0))
 
   getLineStart = lazyMethod(getLineStart)
 

Modified: erp5/trunk/products/ERP5Form/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/SelectionTool.py?rev=21999&r1=21998&r2=21999&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/SelectionTool.py (original)
+++ erp5/trunk/products/ERP5Form/SelectionTool.py Fri Jun 27 11:28:52 2008
@@ -672,8 +672,9 @@
       selection = self.getSelectionFor(list_selection_name, REQUEST)
       params = selection.getParams()
       lines = params.get('list_lines', 0)
-      start = params.get('list_start', 0)
-      REQUEST.form['list_start'] = int(start) + int(lines)
+      start = REQUEST.form.pop('list_start', 0)
+      params['list_start'] = int(start) + int(lines)
+      selection.edit(params=params)
       self.uncheckAll(list_selection_name, listbox_uid)
       return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
 
@@ -686,8 +687,9 @@
       selection = self.getSelectionFor(list_selection_name, REQUEST)
       params = selection.getParams()
       lines = params.get('list_lines', 0)
-      start = params.get('list_start', 0)
-      REQUEST.form['list_start'] = max(int(start) - int(lines), 0)
+      start = REQUEST.form.pop('list_start', 0)
+      params['list_start'] = max(int(start) - int(lines), 0)
+      selection.edit(params=params)
       self.uncheckAll(list_selection_name, listbox_uid)
       return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
 
@@ -699,7 +701,7 @@
       if uids is None: uids = []
       selection = self.getSelectionFor(list_selection_name, REQUEST)
       params = selection.getParams()
-      params['list_start'] = REQUEST.form.get('list_start', 0)
+      params['list_start'] = int(REQUEST.form.pop('list_start', 0))
       selection.edit(params=params)
       self.uncheckAll(list_selection_name, listbox_uid)
       return self.checkAll(list_selection_name, uids, REQUEST=REQUEST, query_string=query_string)




More information about the Erp5-report mailing list