BaseForms validation and ValidationError's params
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In forms/forms.py the _clean_fields function of BaseForm waits for ValidationError exception and inserts e.messages to self._errors.
The problem is that ValidationError supports quite useful things, like params, understanding dict arguments, etc. Since forms/forms.py takes only e.messages, there's no way to access later these parameters.
Would this make a reasonable request for improvement of BaseForms: instead of using e.messages, wrap the returned exception into some object, whose unicode method returns e.messages (to preserve compatibility), with additional properties taken from ValidationError.params?
This would allow for fine-grained error reporting. Not only would we have error messages reported per field, but could also specify additional parameters in the error message.