﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
3284	Form clean() method does not trap ValidationError exception	Chris Rose <no-spam@…>	Adrian Holovaty	"{{{
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
}}} "	defect	closed	Forms		normal	worksforme			Unreviewed	0	0	0	0	0	0
