diff options
| author | Chris McDonough <chrism@plope.com> | 2012-01-08 16:24:58 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-01-08 16:24:58 -0500 |
| commit | 2fd0945e7fac522e76ca180fe53067f46d728278 (patch) | |
| tree | e6daaed503e66c2f33cb9edbf759d38ad1f9a2ef /webob/request.py | |
| parent | 63302b67d06d519c569f325528c98bae5bcbf9d5 (diff) | |
| download | webob-feature.pathinfogeddon.tar.gz | |
add tests, add docs describing all changesfeature.pathinfogeddon
Diffstat (limited to 'webob/request.py')
| -rw-r--r-- | webob/request.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/webob/request.py b/webob/request.py index f76b754..50bb407 100644 --- a/webob/request.py +++ b/webob/request.py @@ -281,8 +281,16 @@ class BaseRequest(object): parse_int, serialize_int, 'int') # raw wsgi values (bytes on py2, bytes-tunneled-via-text on py3) - script_name = environ_getter('SCRIPT_NAME', '') - path_info = environ_getter('PATH_INFO') + script_name = deprecated_property( + environ_getter('SCRIPT_NAME', ''), + 'script_name', + 'deprecated in WebOb 1.2, use scriptname or scriptname_bytes instead', + '1.4') + path_info = deprecated_property( + environ_getter('PATH_INFO'), + 'path_info', + 'deprecated in WebOb 1.2, use pathinfo or pathinfo_bytes instead', + '1.4') if PY3: # pragma: no cover def _bytes_to_wsgi(self, val): @@ -671,7 +679,8 @@ class BaseRequest(object): Optional ``pattern`` argument is a regexp to match the return value before returning. If there is no match, no changes are made to the - request and None is returned. + request and None is returned. The pattern must always match against + a bytes object (not unicode). """ path = self.pathinfo_bytes if not path: @@ -684,7 +693,7 @@ class BaseRequest(object): if idx == -1: idx = len(path) r = path[:idx] - if pattern is None or re.match(pattern, r.decode(self.url_encoding)): + if pattern is None or re.match(pattern, r): self.scriptname_bytes += slashes + r self.pathinfo_bytes = path[idx:] return r |
