#14499 closed (fixed)
ATSocialSecurityNumberField doesn't handle EMPTY_VALUES correctly
Reported by: | Idan Gazit | Owned by: | Idan Gazit |
---|---|---|---|
Component: | contrib.localflavor | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | How to create a pull request | ||
Description ¶
Fields with required=False should not choke while cleaning any value in EMPTY_VALUES (from django.core.validators):
EMPTY_VALUES = (None, '', [], (), {})
There's at least one case of this in contrib/localflavor/at/forms.py; ATSocialSecurityNumberField
; it chokes while cleaning a value of None
.
Discovered while porting localflavor's doctests to unittests. In an effort to standardize testing for all of unittest, refactored testing of required vs optional fields to try all values in EMPTY_VALUES, and ran across this issue.
Change History (7)
by , 14 years ago
Attachment: | 14499.diff added |
---|
comment:1 by , 14 years ago
Has patch: | set |
---|
comment:2 by , 14 years ago
Summary: | Some localflavor fields don't handle EMPTY_VALUES correctly → ATSocialSecurityNumberField doesn't handle EMPTY_VALUES correctly |
---|
Updating to split instances of this issue into separate tickets.
comment:3 by , 14 years ago
Status: | new → assigned |
---|
comment:4 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The field in question, ATSocialSecurityNumberField, simply didn't follow the accepted pattern (call super, then check EMPTY_VALUES). Patch attached.