summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-12-18 20:33:44 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-12-18 20:33:44 +0000
commitbc27405fc563acaaef08f47662e6597e9e1751a0 (patch)
tree148d4fe49eff2ea0c30a8ef7a8903d15dabf39fa /django
parentf4bc738e6b67a85e87d7abb7aa15ea37d5c701c5 (diff)
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
Diffstat (limited to 'django')
-rw-r--r--django/contrib/localflavor/za/forms.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/django/contrib/localflavor/za/forms.py b/django/contrib/localflavor/za/forms.py
index 9a54f1ecb2..4fb4203e45 100644
--- a/django/contrib/localflavor/za/forms.py
+++ b/django/contrib/localflavor/za/forms.py
@@ -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)