On Tue, 2007-05-29 at 11:58 +0200, Marc Fargas wrote: > Hi there, > When using i18n I'm getting a nice stacktrace for every request, this > only happens once you set the language for a client and the exception > raises due to Content-Language being a Unicode string for some reason. > > Backtrace: > Traceback (most recent call last): > File > "/var/lib/python-support/python2.4/django/core/servers/basehttp.py", > line 272, in run > self.result = application(self.environ, self.start_response) > File > "/var/lib/python-support/python2.4/django/core/servers/basehttp.py", > line 614, in __call__ > return self.application(environ, start_response) > File > "/var/lib/python-support/python2.4/django/core/handlers/wsgi.py", > line 206, in __call__ > start_response(status, response_headers) > File > "/var/lib/python-support/python2.4/django/core/servers/basehttp.py", > line 360, in start_response > assert type(val) is StringType,"Header values must be > strings" > AssertionError: Header values must be strings > > If I place "import pdb; pdb.set_trace()" on basehttp.py before the > assert it's the Content-Language header the one that is not a string: > > > > /var/lib/python-support/python2.4/django/core/servers/basehttp.py(359)start_response() > -> for name,val in headers: > (Pdb) p headers > [('Vary', 'Accept-Language, Cookie'), ('Content-Type', > 'text/html; charset=utf-8'), ('Content-Language', u'ca'), > ('Set-Cookie', ' sessionid=9935d4ee987c1a0cc42f051fda2bbe09; > expires=Tue, 12-Jun-2007 10:03:45 GMT; Max-Age=1209600; > Path=/;')] > > Not sure if that's my fault that made Content-Language to be a unicode > string or if it's a bug on unicode branch.
There are no bugs on the unicode branch; so it's clearly your fault. :-) However, just this once, we can adjust the code so that this doesn't happen. If anybody doesn't believe software development is hard, this is a beautiful example. I fixed a very similar problem for modpython last night. At the same time I looked for analogous problems in the other handlers and didn't see any. I even checked the tests and http/__init__.py. Tonight, the same sort of problem pops up but in the development *server*, despite the fact that I have been testing things in different locales all along (which is really strange). It's a trivial fix. Wait 30 minutes and try again. 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 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 -~----------~----~----~----~------~----~------~--~---