Title: modjy passes HTTP headers as unicode objects to the WSGI app
Type: Severity: normal
Components: Core Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, leosoto
Priority: Keywords:

Created on 2009-01-25.16:12:57 by leosoto, last changed 2009-02-03.12:09:10 by amak.

msg4072 (view) Author: Leonardo Soto (leosoto) Date: 2009-01-25.16:12:56
Now that java strings are mapped to python unicode objects modjy fills
the WSGI environ with many unicode objects. I'm far from being an expert
on WSGI, but from reading the PEP[1] looks like at least the all the
HTTP_* entries should be str objects. 

One thing that breaks with the current situations are cookies. See point
9 on

msg4073 (view) Author: Leonardo Soto (leosoto) Date: 2009-01-25.16:39:41
In the meantime, for django-jython I'll apply the following workaround

for key in environ:
  if key.startswith('HTTP_') and isinstance(environ[key], unicode):
    environ[key] = environ[key].encode('iso-8859-1')
msg4082 (view) Author: Alan Kennedy (amak) Date: 2009-01-26.16:40:28
You are, of course, correct Leo; CGI vars must be in either ISO-8859-1
or RFC 2047.

I will correct this in modjy straightaway.

However, I won't be checking in the updated version for a day or two;
there are some other features I want to look at adding.
msg4119 (view) Author: Alan Kennedy (amak) Date: 2009-02-03.12:09:10
OK, this is fixed in modjy version 0.25.2.

Checked into trunk at r6007.
Date User Action Args
2009-02-03 12:09:10amaksetstatus: open -> closed
resolution: fixed
messages: + msg4119
2009-01-26 16:40:28amaksetassignee: amak
messages: + msg4082
2009-01-25 16:39:41leosotosetmessages: + msg4073
2009-01-25 16:12:57leosotocreate