On Tue, 2007-06-26 at 04:57 -0700, AnaReis wrote:
> Hi,
> I've been trying to compare two passwords, but I always get the same
> error. This was taken from the django test web page and I tried to run
> it on my idle shell:
> 
> class UserRegistration(Form):
>       username = CharField(max_length=10)
>       password1 = CharField(widget=PasswordInput)
>       password2 = CharField(widget=PasswordInput)
>       def clean_password2(self):
>               if self.cleaned_data.get('password1') and
> self.cleaned_data.get('password2') and self.cleaned_data['password1'] !
> = self.cleaned_data['password2']:
>                       raise ValidationError(u'Please make sure your passwords 
> match.')
>               return self.cleaned_data['password2']
> 
> 
> data={'username':'ana',
>       'password1':'123',
>       'password2':'4232'}
> f=UserRegistration(data)
> f.clean()
> 
> Traceback (most recent call last):
>   File "<pyshell#190>", line 1, in <module>
>     f.clean()
>   File "/nobackup/reis/Python/lib/python2.5/site-packages/django/
> newforms/forms.py", line 199, in clean
>     return self.clean_data
> AttributeError: 'UserRegistration' object has no attribute
> 'clean_data'

Your example is using "cleaned_data", but this traceback is using older
Django code that is using "clean_data" as the attribute on the Form. So
there's a mismatch in the versions of the code you are using somewhere.

Regards,
Malcolm

-- 
For every action there is an equal and opposite criticism. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to