[Python-Dev] [Web-SIG] Backup plan: WSGI 1 Addenda and wsgiref update for Py3 (original) (raw)
Ian Bicking ianb at colorstudy.com
Tue Sep 21 18:57:44 CEST 2010
- Previous message: [Python-Dev] Backup plan: WSGI 1 Addenda and wsgiref update for Py3
- Next message: [Python-Dev] Backup plan: WSGI 1 Addenda and wsgiref update for Py3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Sep 21, 2010 at 12:09 PM, P.J. Eby <pje at telecommunity.com> wrote:
The Python 3 specific changes are to use:
*
bytes
for I/O streams in both directions *str
for environ keys and values *bytes
for arguments to startresponse() and write()
This is the only thing that seems odd to me -- it seems like the response should be symmetric with the request, and the request in this case uses str for headers (status being header-like), and bytes for the body.
Otherwise this seems good to me, the only other major errata I can think of are all listed in the links you included.
- text stream for wsgi.errors
In other words, "strings in, bytes out" for headers, bytes for bodies. In general, only changes that don't break Python 2 WSGI implementations are allowed. The changes should also not break modwsgi on Python 3, but may make some Python 3 wsgi applications non-compliant, despite continuing to function on modwsgi. This is because modwsgi allows applications to output string headers and bodies, but I am ruling that option out because it forces every piece of middleware to have to be tested with arbitrary combinations of strings and bytes in order to test compliance. If you want your application to output strings rather than bytes, you can always use a decorator to do that. (And a sample one could be provided in wsgiref.)
-- Ian Bicking | http://blog.ianbicking.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20100921/cd1049c8/attachment.html>
- Previous message: [Python-Dev] Backup plan: WSGI 1 Addenda and wsgiref update for Py3
- Next message: [Python-Dev] Backup plan: WSGI 1 Addenda and wsgiref update for Py3
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]