summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-12-18 20:31:49 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-12-18 20:31:49 +0000
commitf8caeefff193e4ace0db13c7213194be933584f7 (patch)
tree9eb2a4633fa652c61c874fce3fc227997cf80d36 /django
parent58bc8819909ff1f867b3c7b0f6cb283e589d99c0 (diff)
Fixed #14859 -- ITSocialSecurityNumberField and ITVatNumberField didn't handle all EMPTY_VALUES gracefully. Also converted the Italias localflavor doctests into unittests. We have always been at war with doctests. Thanks to Idan Gazit.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14945 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/localflavor/it/forms.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/django/contrib/localflavor/it/forms.py b/django/contrib/localflavor/it/forms.py
index baa56a21ba..bf0227608a 100644
--- a/django/contrib/localflavor/it/forms.py
+++ b/django/contrib/localflavor/it/forms.py
@@ -50,8 +50,8 @@ class ITSocialSecurityNumberField(RegexField):
def clean(self, value):
value = super(ITSocialSecurityNumberField, self).clean(value)
- if value == u'':
- return value
+ if value in EMPTY_VALUES:
+ return u''
value = re.sub('\s', u'', value).upper()
try:
check_digit = ssn_check_digit(value)
@@ -71,8 +71,8 @@ class ITVatNumberField(Field):
def clean(self, value):
value = super(ITVatNumberField, self).clean(value)
- if value == u'':
- return value
+ if value in EMPTY_VALUES:
+ return u''
try:
vat_number = int(value)
except ValueError: