[Erp5-report] r32492 yo - /erp5/trunk/products/ERP5Form/ListBox.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 12 13:35:16 CET 2010


Author: yo
Date: Fri Feb 12 13:35:11 2010
New Revision: 32492

URL: http://svn.erp5.org?rev=32492&view=rev
Log:
Catch KeyError in the validator, because KeyError seems to be caught and ignored at somewhere, and disappear on the screen. So it is translated into ValidationError somehow. Typically, this error happens when there is any editable column which does not appear in columns.

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

Modified: erp5/trunk/products/ERP5Form/ListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ListBox.py?rev=32492&r1=32491&r2=32492&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ListBox.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/ListBox.py [utf8] Fri Feb 12 13:35:11 2010
@@ -2545,6 +2545,8 @@
 
 class ListBoxValidator(Validator.Validator):
     property_names = Validator.Validator.property_names
+    message_names = Validator.Validator.message_names + ['required_not_found']
+    required_not_found = 'Input is required but no input given.'
 
     def validate(self, field, key, REQUEST):
         form = field.aq_parent
@@ -2660,6 +2662,10 @@
                     #LOG("ListBox ValidationError",0,str(err))
                     err.field_id = error_result_key
                     errors.append(err)
+                  except KeyError:
+                    err = ValidationError('required_not_found', field)
+                    err.field_id = field.id
+                    errors.append(err)
           else:
             # Second case: modification of existing objects
             #try:
@@ -2710,6 +2716,10 @@
                       #LOG("ListBox ValidationError",0,str(err))
                       err.field_id = error_result_key
                       errors.append(err)
+                    except KeyError:
+                      err = ValidationError('required_not_found', field)
+                      err.field_id = field.id
+                      errors.append(err)
             #except:
             else:
               LOG("ListBox WARNING",0,"Object uid %s could not be validated" % uid)




More information about the Erp5-report mailing list