From c1f73b89079e314968035e17ae0c78cf8676f77f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Thu, 14 Sep 2006 11:22:15 +0000
Subject: [PATCH] remove useless parameters even in listbox

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9905 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/ListBox.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index 60a2f18104..15fe512827 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -920,8 +920,17 @@ class ListBoxRenderer:
         elif meta_type_list is not None:
           params.setdefault('meta_type', meta_type_list)
 
-        # Remove useless parameters.
-        for k, v in params.items():
+        # Remove useless parameters as FileUpload
+        for k, v in params.items():          
+          if k == "listbox":
+            # listbox can also contain useless parameters
+            new_list = []
+            for line in v:
+              for k1, v1 in line.items():
+                if v1 in (None, '') or hasattr(v1, 'read'):
+                  del line[k1]
+              new_list.append(line)
+            params[k] = new_list                            
           if v in (None, '') or hasattr(v, 'read'):
             del params[k]
 
@@ -961,7 +970,6 @@ class ListBoxRenderer:
     # objects in the current ListBox configuration.
     if 'select_expression' in params:
       del params['select_expression']
-
     return params
 
   getParamDict = VolatileCachingMethod(getParamDict)
@@ -1844,6 +1852,7 @@ class ListBoxRendererLine:
 
       value_list.append((original_value, processed_value))
 
+    #LOG('ListBox.getValueList', 0, value_list)
     return value_list
 
 class ListBoxHTMLRendererLine(ListBoxRendererLine):
-- 
2.30.9