Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3718 -- Exposed form errors to cleaning methods as soon as the…

…y are

available. Patch from Gary Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5348 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a901b44c15d024a7a15ccbff5d167118427b924c 1 parent 1c42c7c
@malcolmt malcolmt authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 django/newforms/forms.py
View
10 django/newforms/forms.py
@@ -174,9 +174,8 @@ def full_clean(self):
Cleans all of self.data and populates self._errors and
self.cleaned_data.
"""
- errors = ErrorDict()
+ self._errors = ErrorDict()
if not self.is_bound: # Stop further processing.
- self._errors = errors
return
self.cleaned_data = {}
for name, field in self.fields.items():
@@ -191,16 +190,15 @@ def full_clean(self):
value = getattr(self, 'clean_%s' % name)()
self.cleaned_data[name] = value
except ValidationError, e:
- errors[name] = e.messages
+ self._errors[name] = e.messages
if name in self.cleaned_data:
del self.cleaned_data[name]
try:
self.cleaned_data = self.clean()
except ValidationError, e:
- errors[NON_FIELD_ERRORS] = e.messages
- if errors:
+ self._errors[NON_FIELD_ERRORS] = e.messages
+ if self._errors:
delattr(self, 'cleaned_data')
- self._errors = errors
def clean(self):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.