#3284: Form clean() method does not trap ValidationError exception
---------------------------------------------+------------------------------
Reporter: Chris Rose <[EMAIL PROTECTED]> | Owner: adrian
Type: defect | Status: new
Priority: normal | Milestone:
Component: django.newforms | Version:
Severity: normal | Keywords:
---------------------------------------------+------------------------------
{{{
class CreateUserForm(forms.Form):
username = forms.CharField(max_length=20)
email = forms.EmailField()
password = forms.CharField(widget=forms.PasswordInput)
password2 = forms.CharField(widget=forms.PasswordInput, label="Confirm
Password")
def clean(self):
if self.clean_data.has_key('password') and
self.clean_data.has_key('password2'):
if self.clean_data['password'] !=
self.clean_data['password2']:
raise ValidationError("The passwords you have entered do
not match.")
return self.clean_data
}}}
When the above form is validated, if both password fields are set but do
not match the ValidationError exception does not get caught by
BaseForm.full_clean() as I think it should. The ValidationError should
make its way into the form level error list, but instead all you get is a
traceback.
{{{
ValidationError at /users/new/
[u'The passwords you have entered do not match.']
Request Method: POST
Request URL: http://localhost:8000/users/new/
Exception Type: ValidationError
Exception Value: [u'The passwords you have entered do not match.']
Exception Location: /home/devel/jewel/../jewel/user/views.py in clean,
line 32
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/3284>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---