[Erp5-report] r43238 nicolas - /erp5/trunk/products/Formulator/Errors.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Feb 9 17:21:36 CET 2011
Author: nicolas
Date: Wed Feb 9 17:21:36 2011
New Revision: 43238
URL: http://svn.erp5.org?rev=43238&view=rev
Log:
Allow to customize error_message passed to the user
from ExternalValidator.
Modified:
erp5/trunk/products/Formulator/Errors.py
Modified: erp5/trunk/products/Formulator/Errors.py
URL: http://svn.erp5.org/erp5/trunk/products/Formulator/Errors.py?rev=43238&r1=43237&r2=43238&view=diff
==============================================================================
--- erp5/trunk/products/Formulator/Errors.py [utf8] (original)
+++ erp5/trunk/products/Formulator/Errors.py [utf8] Wed Feb 9 17:21:36 2011
@@ -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)
More information about the Erp5-report
mailing list