diff options
| author | Sergey Schetinin <sergey@maluke.com> | 2011-09-24 18:58:51 +0300 |
|---|---|---|
| committer | Sergey Schetinin <sergey@maluke.com> | 2011-09-24 18:58:51 +0300 |
| commit | 4da4e9658a96cfe1b2d1fe194ed11cf761c50968 (patch) | |
| tree | 964acb149000b94a769fbcc94e4cec8d2638e896 | |
| parent | a8f984dfc5d1a6947ca29e99f8cb75dd818a6762 (diff) | |
| download | webob-4da4e9658a96cfe1b2d1fe194ed11cf761c50968.tar.gz | |
make path_info, script_name unicode, deprecate u*
| -rw-r--r-- | tests/test_request.py | 2 | ||||
| -rw-r--r-- | webob/request.py | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/tests/test_request.py b/tests/test_request.py index 77ec7ba..3c6b972 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -2100,6 +2100,8 @@ class RequestTests_functional(unittest.TestCase): from webob.request import environ_from_url env = environ_from_url('/%E6%B5%81') self.assertEqual(env['PATH_INFO'], '/\xe6\xb5\x81') + self.assertEqual(Request(env).path_info, text_('/\xe6\xb5\x81', 'utf8')) # u'/\u6d41' + def test_post_does_not_reparse(self): # test that there's no repetitive parsing is happening on every diff --git a/webob/request.py b/webob/request.py index 4b64ba7..f7a441c 100644 --- a/webob/request.py +++ b/webob/request.py @@ -185,8 +185,6 @@ class BaseRequest(object): scheme = environ_getter('wsgi.url_scheme') method = environ_getter('REQUEST_METHOD', 'GET') http_version = environ_getter('SERVER_PROTOCOL') - script_name = environ_getter('SCRIPT_NAME', '') - path_info = environ_getter('PATH_INFO') content_length = converter( environ_getter('CONTENT_LENGTH', None, '14.13'), parse_int_safe, serialize_int, 'int') @@ -198,9 +196,20 @@ class BaseRequest(object): environ_getter('SERVER_PORT'), parse_int, serialize_int, 'int') - uscript_name = upath_property('SCRIPT_NAME') - upath_info = upath_property('PATH_INFO') - + script_name = upath_property('SCRIPT_NAME') + path_info = upath_property('PATH_INFO') + uscript_name = deprecated_property( + script_name, + 'uscript_name', + "Use script_name directly", + '1.3' + ) + upath_info = deprecated_property( + path_info, + 'upath_info', + "Use path_info directly", + '1.3' + ) def _content_type__get(self): """Return the content type, but leaving off any parameters (like |
