[Web-SIG] Clarifications on Python 3.0 and WSGI.
Phillip J. Eby
pje at telecommunity.com
Tue Mar 25 16:31:56 CET 2008
At 04:54 PM 3/25/2008 +1100, Graham Dumpleton wrote:
>Why are servers and gateways being made to accept strings when the
>preference is for applications to produce bytes for both? Is this
>acknowledgment that getting people to convert WSGI applications to
>produce bytes may be a problem?
>The text of (2) sorts of suggests there is justification for this in
>saying 'under the existing rules (i.e., s.encode('latin-1') must
>convert the string to bytes without an exception', but I can't find
>such a rule in the WSGI PEP when I have a quick look. In other words,
>where in the existing specification does it say that Unicode strings
>must be accepted, to the contrary it suggests they can't be and that
>using them where a string object is expected is undefined.
It says that in versions of Python where 'str is unicode' (i.e.
Jython, IronPython, and Python 3000), then the specification should
be read to define "string" as a unicode string whose characters can
be expressed in latin-1.
Really, adding support for bytes is the stretch here. In fact, I'd
almost go so far as to say the heck with bytes support except for the
response body. I could easily consider headers to be text, instead.
More information about the Web-SIG