diff options
| author | Honza Král <honza.kral@gmail.com> | 2009-06-01 15:38:11 +0000 |
|---|---|---|
| committer | Honza Král <honza.kral@gmail.com> | 2009-06-01 15:38:11 +0000 |
| commit | 55e23d5efaa11b7385c9c0d117378b07cdeb7341 (patch) | |
| tree | 3f256f30b15ca2212bb248bf06d484fa73481aa3 /django/forms/forms.py | |
| parent | a2b215263596b1778054e3e8710dd6da13063f16 (diff) | |
[soc2009/model-validation] Moved ValidationError to django.core.exceptions and removed ErrorList from within the Error
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/forms.py')
| -rw-r--r-- | django/forms/forms.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py index 1b9faa7e4d..6b6f1c5971 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -4,6 +4,7 @@ Form classes from copy import deepcopy +from django.core.exceptions import ValidationError from django.utils.datastructures import SortedDict from django.utils.html import conditional_escape from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode @@ -11,7 +12,7 @@ from django.utils.safestring import mark_safe from fields import Field, FileField from widgets import Media, media_property, TextInput, Textarea -from util import flatatt, ErrorDict, ErrorList, ValidationError +from util import flatatt, ErrorDict, ErrorList __all__ = ('BaseForm', 'Form') @@ -243,13 +244,13 @@ class BaseForm(StrAndUnicode): value = getattr(self, 'clean_%s' % name)() self.cleaned_data[name] = value except ValidationError, e: - self._errors[name] = e.messages + self._errors[name] = self.error_class(e.messages) if name in self.cleaned_data: del self.cleaned_data[name] try: self.cleaned_data = self.clean() except ValidationError, e: - self._errors[NON_FIELD_ERRORS] = e.messages + self._errors[NON_FIELD_ERRORS] = self.error_class(e.messages) if self._errors: delattr(self, 'cleaned_data') |
