#18431: TypedChoiceField doesn't use self.coerce in its clean() and
prepare_value()
methods
------------------------+--------------------------------------
Reporter: ambv | Owner: nobody
Type: Bug | 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: 1 | UI/UX: 0
------------------------+--------------------------------------
Comment (by anonymous):
You're right. `coerce` is indeed invoked in
`TypedChoiceField.to_python()`. The problem however is with the fact that
this method first calls `ChoiceField.to_python()` which blatantly runs
`smart_unicode(value)` regardless of whether that's compatible with
`coerce` or not. Moreover, the following line in
`TypedChoiceField.to_python()` reads:
`super(TypedChoiceField, self).validate(value)`
which means it skips `TypedChoiceField.validate()` and runs the super
`ChoiceField.validate()` instead. Is that conscious design or is it a bug?
Also, note that `prepare_value()` does not use `coerce` at all.
--
Ticket URL: <https://code.djangoproject.com/ticket/18431#comment:2>
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 this group at
http://groups.google.com/group/django-updates?hl=en.