On Sun, 2007-07-01 at 19:53 +0200, Dirk van Oosterbosch, IR labs wrote:
> Hello,
> 
> 
> I think I might have a similar problem. Or at least it seems to be a
> Unicode thing.
> Unfortunately, however, I cannot switch to the unicode-branch, because
> I'm stuck to the ports (version 0.96 ATM).
> 
> 
> I am comparing the value stored in the model (database) with the value
> coming in from a form.
> They *are* equal (since the string was stored in the db before).
> Python/Django however thinks different:
> 
> 
> /domains/ouwepikouwepijp.nl/python/opop/uploads/upload.py:98:
> UnicodeWarning: Unicode equal comparison failed to convert both
> arguments to Unicode - interpreting them as being unequal
> if not (default_movies[i].name == self.clean_data['name%d' % (i+1)]):

Explicity convert the non-unicode argument to unicode. I'm guessing that
it's the lefthand side of the comparison that is not Unicode. So change
it to compare:

        unicode(default_movies[i].name, 'ascii') == self.clean_data[...]
        
(change 'ascii' to 'utf-8' or whatever the appropriate encoding for the
bytestring might be).

Regards,
Malcolm


-- 
Save the whales. Collect the whole set. 
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 django-users@googlegroups.com
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