#24988: ValidationError fails to set code
---------------------------------+--------------------------------------
Reporter: michaeljohnbarr | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution:
Keywords: ValidationError | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Comment (by loic):
`code` and `params` are really intended for single message
`ValidationError`, if we did pass `code=code` in the constructor we'd be
effectively creating an implicit shortcut, I don't think it's a good idea
(explicit better than implicit, TIMTOWTDI, etc.). Also it's ambiguous if
you pass a `dict` that mixes strings (which will be turned into
`ValidationError`) and `ValidationError` instances.
Raising `ValidationError` with `error_dict` is mostly useful in
`Model.clean()` because forms have better APIs (i.e. `Form.add_error()`),
but I guess we can still document it in
[https://docs.djangoproject.com/en/1.8/ref/forms/validation/#raising-
validationerror Raising ValidationError] if only for the sake of
exhaustivity.
--
Ticket URL: <https://code.djangoproject.com/ticket/24988#comment:5>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/073.19017a0fbb762db41fe2a70c06b97c34%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.