From 1bfd5f23f76e811cf6701b7c8eb9eaa5313433f2 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Tue, 21 Apr 2009 15:16:32 +0000
Subject: [PATCH] Extend filtering to more borderline cases: - fields commonly
 found in listbox HTML renderer - fields commonly found in xhtml style -
 fields with empty string as a value, which can be empty listbox columns

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

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index 1c3b4275c3..0c91c7ea90 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -85,9 +85,22 @@ class CatalogMethodWrapper(MethodWrapper):
   """
   def __call__(self, *args, **kw):
     for parameter_id in ('selection', 'selection_name', 'select_columns',
-                         'reset', 'selection_index', 'list_selection_name',
-                         'list_start', 'list_lines'):
+      'reset', 'selection_index', 'list_selection_name', 'list_start',
+      'list_lines',
+      # Also strip common HTML field names
+      # XXX: I'm not sure if those values really belong to here
+      'md5_object_uid_list', 'cancel_url', 'listbox_list_selection_name',
+      'form_id', 'select_language', 'select_favorite', 'select_module',
+      'select_jump', 'select_action', 'Base_doSelect'):
       kw.pop(parameter_id, None)
+    # Strip all entries which have an empty string as value (ie, an empty
+    # field).
+    # XXX: I'm not sure if this filtering really belongs to here.
+    # It is probably needed at a more generic level (Forms ? Selection ?), or
+    # even a more specific one (limited to HTML ?)...
+    for key, value in kw.items():
+      if value == '':
+        kw.pop(key)
     return getattr(self.context, self.method_name)(*args, **kw)
 
 class ReportTree:
-- 
2.30.9