1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #14871, #14872 -- ZAIDField didn't handle alll EMPTY_VALUES correctly and ZAPostCodeField didn't respect *args or **kwargs (such as required=False). Also converted South African localflavor doctests into unittests. We have always been at war with doctests. Thanks to Idan Gazit.

Fixing ZA localflavor clean() #14872

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14956 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor
2010-12-18 20:33:44 +00:00
parent f4bc738e6b
commit bc27405fc5
5 changed files with 32 additions and 45 deletions

View File

@@ -22,14 +22,14 @@ class ZAIDField(Field):
}
def clean(self, value):
# strip spaces and dashes
value = value.strip().replace(' ', '').replace('-', '')
super(ZAIDField, self).clean(value)
if value in EMPTY_VALUES:
return u''
# strip spaces and dashes
value = value.strip().replace(' ', '').replace('-', '')
match = re.match(id_re, value)
if not match:
@@ -57,4 +57,4 @@ class ZAPostCodeField(RegexField):
def __init__(self, *args, **kwargs):
super(ZAPostCodeField, self).__init__(r'^\d{4}$',
max_length=None, min_length=None)
max_length=None, min_length=None, *args, **kwargs)