On Mon, 2007-10-15 at 12:24 +0530, Kenneth Gonsalves wrote: > > On 15-Oct-07, at 10:57 AM, Malcolm Tredinnick wrote: > > > So, in the rare case where, say, self.sponsor is a UTF-8 string, > > Kenneth's version might lead to trouble down the track -- but I would > > have thought that trouble would be mis-displayed strings, rather > > than a > > crash. > > ok - when I put 'u' in the __unicode__() method, no crash
Hmm .. interesting. Something tricky is going on, then. Still, if it's solved by using good Python practices, I'm a bit less worried than before. It's far from perfect, because I don't understand the *why* of the problem, but it's not necessarily a fatal flaw in our code, which was my main worry. > > Still, it would be worth checking that self.sponsor and self.child > > really are Unicode strings (and not bytestrings) in the case where a > > crash occurs, Kenneth. Or at least working out what they *are* when > > the > > crash occurs. > > i dont know whether I know how to do that - but will try. One way would be to insert some extra code into that __unicode__ method so that every time you call it, you log to a file the types and values of the things you are using to create the result. Dumping out repr(...) of the things you use to construct the string, for example, might give you some clues. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

