[Web-SIG] WSGI for Python 3

Ian Bicking ianb at colorstudy.com
Sat Jul 17 03:46:43 CEST 2010


On Fri, Jul 16, 2010 at 6:20 PM, Chris McDonough <chrism at plope.com> wrote:

>  > What are the concrete problems you envision with text request headers,
> > text (URL-quoted) path, and text response status and headers?
>
> Documentation is the main reason.  For example, the documentation for
> making sense of path_info segments in a WSGI that used unicodey-strings
> would, as I understand it, read something like this:
>

Nah, not nearly that hard:

path_info =
urllib.parse.unquote_to_bytes(environ['wsgi.raw_path_info']).decode('UTF-8')

I don't see the problem?  If you want to distinguish %2f from /, then you'll
do it slightly differently, like:

path_parts = [
    urllib.parse.unquote_to_bytes(p).decode('UTF-8')
    for p in environ['wsgi.raw_path_info'].split('/')]

This second recipe is impossible to do currently with WSGI.

So... before jumping to conclusions, what's the hard part with using text?

-- 
Ian Bicking  |  http://blog.ianbicking.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/web-sig/attachments/20100716/667d601c/attachment.html>


More information about the Web-SIG mailing list