Karen, I thank you a million times over. You have no idea how many hours I've spent on this issue. :)
I got it working by using exactly the method you specified. Finally I'll be able to get some sleep at night! Take care, Alex On Dec 3, 8:18 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Wed, Dec 3, 2008 at 10:14 AM, Alex Jonsson <[EMAIL PROTECTED]>wrote: > > > > > > > > > Guys, I'm in trouble. > > > I'm using the django-tagging application with a Swedish news > > application. It generally works, but there's one big problem which has > > taken me forever to solve. > > > I've concluded that the issue lies in the > >http://django-tagging.googlecode.com/svn/trunk/tagging/models.pyfile. > > If you look at the __unicode__ method all the way down in the bottom, > > it refers to self.object and self.tag. The self.object in my case is > > an Article object which __unicode__ method returns the the title of > > the Article in a u'%s' % (self.title) format. > > > The issue is that when this title includes "special" characters (åäö), > > it breaks in the admin and gives me an error which looks like this: > > > DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in > > position 0: ordinal not in range(128). You passed in <TaggedItem: [Bad > > Unicode data]> (<class 'tagging.models.TaggedItem'>) > > > Another strange thing is that it works on my local machine, but not on > > the live server. The local server runs Python 2.5, whereas the live > > goes for 2.3. > > I think you are hitting a Python 2.3 unicode bug. Something like: > > u'%s' % obj > > should call obj's unicode method, if it exists. However in Python 2.3 obj's > str method is called instead. The common workaround for this is to write > instead: > > u'%s' % unicode(obj) > > It sounds like one or more of the django-tagging model __unicode__ methods > needs to employ this workaround in order to work properly under Python 2.3. > > Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---