Fixed #4390, #4385 -- Made it clear that cleaned_data wasn't being assigned to

twice without reason. Also make sure that if field specific clean functions
fail, the form-wide field cleaning is removed from cleaned_data.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5346 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-05-26 08:47:15 +00:00
parent dfdf7bdc5e
commit 198127a0f2
1 changed files with 3 additions and 1 deletions

View File

@ -188,9 +188,11 @@ class BaseForm(StrAndUnicode):
self.cleaned_data[name] = value self.cleaned_data[name] = value
if hasattr(self, 'clean_%s' % name): if hasattr(self, 'clean_%s' % name):
value = getattr(self, 'clean_%s' % name)() value = getattr(self, 'clean_%s' % name)()
self.cleaned_data[name] = value self.cleaned_data[name] = value
except ValidationError, e: except ValidationError, e:
errors[name] = e.messages errors[name] = e.messages
if name in self.cleaned_data:
del self.cleaned_data[name]
try: try:
self.cleaned_data = self.clean() self.cleaned_data = self.clean()
except ValidationError, e: except ValidationError, e: