Commit c682f9d1 authored by Nicolas Delaby's avatar Nicolas Delaby

Allow to customize error_message passed to the user

from ExternalValidator.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43238 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 944e4050
......@@ -17,12 +17,15 @@ allow_class(FormValidationError)
class ValidationError(Exception):
def __init__(self, error_key, field):
def __init__(self, error_key, field, error_text=None):
Exception.__init__(self, error_key)
self.error_key = error_key
self.field_id = field.id
self.field = field
self.error_text = field.get_error_message(error_key)
if error_text is not None:
self.error_text = error_text
else:
self.error_text = field.get_error_message(error_key)
allow_class(ValidationError)
......
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