diff options
| author | Honza Král <honza.kral@gmail.com> | 2009-06-08 00:55:07 +0000 |
|---|---|---|
| committer | Honza Král <honza.kral@gmail.com> | 2009-06-08 00:55:07 +0000 |
| commit | 6d840d9b05f62a4eded37c6cc2da624a41d92e07 (patch) | |
| tree | 15c41227204e54b72db9816e56e89a66a690cca1 /django/forms/forms.py | |
| parent | ca9cecb70280d55bff0e4422e996f40f8e1ea8ca (diff) | |
[soc2009/model-validation] Introduced ComplexValidator and changed the validator handling logic.
Field.validate() now calls all validators except for ComplexValidator
instances which are then run in the form's clean() method.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10946 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/forms.py')
| -rw-r--r-- | django/forms/forms.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py index b5c0fc06e0..912fd7c031 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -5,6 +5,7 @@ Form classes from copy import deepcopy from django.core.exceptions import ValidationError +from django.core.validators import ComplexValidator from django.utils.datastructures import SortedDict from django.utils.html import conditional_escape from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode @@ -254,6 +255,9 @@ class BaseForm(StrAndUnicode): if not name in self.cleaned_data: continue for v in field.validators: + # skip noncomplex validators, they have already been run on the Field + if not isinstance(v, ComplexValidator): + continue try: v(self.cleaned_data[name], all_values=self.cleaned_data) except ValidationError, e: |
