[Web-SIG] Python 3.0 and WSGI 1.0.

Robert Brewer fumanchu at aminus.org
Wed Apr 1 14:18:37 CEST 2009


Graham Dumpleton wrote:
> Based on any discussions at PyCon, can someone give a summary of any
> conclusions drawn about how WSGI 1.0 should be implemented in Python
> 3.0.
> 
> The previous analysis of this is at:
> 
>   http://www.wsgi.org/wsgi/Amendments_1.0
> 
> I realise it may be work in progress, but I note that work being done
> on WSGI server associated with CherryPy for Python 3.0 by Robert isn't
> necessarily following that and is perhaps starting to do things in a
> way that I understood were only being speculated upon for WSGI 2.0,
> not for WSGI 1.0. For example:
> 
>   http://www.cherrypy.org/changeset/2199
> 
> In particular, it has:
> 
>   environ["SCRIPT_NAME"] = b""
> 
> The bit from prior analysis which is relevant is:
> 
> """When running under Python 3, servers MUST provide CGI HTTP
> variables as strings, decoded from the headers using HTTP standard
> encodings (i.e. latin-1 + RFC 2047) (Open question: are there any CGI
> or WSGI variables that should NOT be strings?)"""
> 
> Since mod_wsgi has used the prior analysis as basis of Python 3.0
> support, would want to know pretty soon what direction WSGI 1.0 under
> Python 3.0 is going to take, else I am going to have to delay
> releasing mod_wsgi 3.0 or simply yank the support for Python 3.0.
> 
> Robert, yes I know I could have asked you direct, but want a consensus
> from all who were present at PyCon and discussed these things.

Good timing. We had been thinking to make everything strings except for
SCRIPT_NAME, PATH_INFO, and QUERY_STRING, since these few are pulled
from the Request-URI, which may be in any encoding. It was thought that
the app would be best-qualified to decode those three.

I hope to discuss that further this morning at the sprints. Turns out
the cgi module in Python 3 only does text, not bytes. I considered
submitting a patch to make it handle bytes for fp/environ but that
became difficult quickly and may complicate the cgi module needlessly if
we can instead use unicode for those 3 environ entries. I'll report back
here.


Robert Brewer
fumanchu at aminus.org



More information about the Web-SIG mailing list