Commit c1ca1ffc authored by Vincent Pelletier's avatar Vincent Pelletier

Handle KeyError exceptions specially in validate_all, because they are only...

Handle KeyError exceptions specially in validate_all, because they are only caused by missing fields, and it must not be fatal.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8258 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fd8a53cc
No related merge requests found
......@@ -407,6 +407,7 @@ class ERP5Form(ZMIForm, ZopePageTemplate):
if they occur and raise a FormValidationError in the end if any
Validation Errors occured.
"""
# import pdb; pdb.set_trace()
result = {}
errors = []
for field in self.get_fields():
......@@ -430,6 +431,8 @@ class ERP5Form(ZMIForm, ZopePageTemplate):
except ValidationError, err:
#LOG('validate_all', 0, 'ValidationError: field.id = %s, err=%s' % (repr(field.id), repr(err)))
errors.append(err)
except KeyError, err:
LOG('ERP5Form/Form.py:validate_all', 0, 'KeyError : %s' % (err, ))
if len(errors) > 0:
raise FormValidationError(errors, result)
return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment