mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user