ATSocialSecurityNumberField doesn't handle EMPTY_VALUES correctly
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)
Summary: |
Some localflavor fields don't handle EMPTY_VALUES correctly → ATSocialSecurityNumberField doesn't handle EMPTY_VALUES correctly
|
Triage Stage: |
Unreviewed → Accepted
|
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.