Pylons/webob — Issue #21: request methods that use path_info are broke under Python 3
Author: mcdonc
Created: 2012-01-06 23:02:09+00:00
State: open

Because PEP-3333-WSGI uses bytes-tunneled-in-latin-1 as PATH_INFO, the following methods of a WebOb request will produce unexpected results on Python 3:

@property
def path_url(self):
"""
The URL including SCRIPT_NAME and PATH_INFO, but not QUERY_STRING
"""
return self.application_url + url_quote(
self.environ.get('PATH_INFO', ''), PATH_SAFE)

@property
def path(self):
"""
The path of the request, without host or query string
"""
return (url_quote(self.script_name, PATH_SAFE) +
url_quote(self.path_info, PATH_SAFE))

Also, ``Request.path_info_pop`` and ``Request.path_info_peek`` and ``environ_from_url`` (and methods/functions that use any of these) will return odd results on Python 3 when PATH_INFO contains nonascii characters.

Bleh. I don't know how to fix this without introducing backwards incompatibilities.