#19592: BaseForms validation and ValidationError's params
-----------------------------+--------------------------------------
Reporter: cgenie@… | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Comment (by ko.szymanski@…):
I can think of some nice usecases.
You have some custom FormFields, with custom ValidationErrors.
Then when you implement some custom error handling for I guess an ajax
calls and you wan't some nice looking errors to be returned by your form,
like:
{{{
['field': {'type': 'validation', 'importants': 'low', 'descritption':
'Error msg', (some_other_params from exception...)}]
}}}
You can't do it without ValidationError or ValidationError.params.
It's not so big hack, just pass some additional info:
{{{
self._errors[name] = self.error_class(e.messages)
}}}
Would be like:
{{{
self._errors[name] = self.error_class(e.messages, e.code, e.params)
#and smth like this for ErrorList
class ErrorList(list, StrAndUnicode):
def __init__(self, collection, code=None, params=None):
list.__init__(self, collection)
}}}
I leave decision if it's worth or not in your hands. Thanks for your time.
--
Ticket URL: <https://code.djangoproject.com/ticket/19592#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.