On Sun, Jul 12, 2009 at 6:50 AM, zayatzz <[email protected]> wrote:
>
> Hello
>
> I have accountform which's validation should show errors when password
> fields are left empty, but the errors did not show up. So i started
> investigating, what is the problem and inserted this line in my form
> validation:
>
> raise forms.ValidationError(data.items())
>
> And what i saw was:
>
>
> * ('username', u'myusername')
> * ('first_name', u'Alan')
> * ('last_name', u'Kesselmann')
> * ('pwd', u'A234234131332')
> * ('pwdc', u'')
> * ('email', u'[email protected] <u%[email protected]>
> ')
>
> What is that u there? And why? For that u i cant do any checks like
> if data.has_key("pwd") and data.has_key("pwdc"):
> do someting here...
>
Why is what u where? Do you mean the u's preceding the key values? That
indicates the values are unicode strings, not bytestrings. It's normal, and
I don't see how the values being unicode would prevent your example line of
code from working.
Though, checking whether the keys exist probably isn't what you want to do,
as the key (pwdc) in this case exists in the data dictionary but has an
empty value, that that's what you want to be checking for: the empty value,
not a missing key.
Karen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---