diff options
| author | Chris McDonough <chrism@plope.com> | 2011-10-13 07:13:04 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-10-13 07:13:04 -0400 |
| commit | c44147eda679e716c53dc22bed0f0b7a283f7366 (patch) | |
| tree | a51387bfc8317817f3ae5cb55c54e20a111ed4e2 | |
| parent | b025708467136bd33eb0fe14dc8c48bf7a0f8844 (diff) | |
| download | webob-feature.pylons10compat.tar.gz | |
gardenfeature.pylons10compat
| -rw-r--r-- | docs/news.txt | 7 | ||||
| -rw-r--r-- | tests/test_exc.py | 5 | ||||
| -rw-r--r-- | webob/exc.py | 5 |
3 files changed, 15 insertions, 2 deletions
diff --git a/docs/news.txt b/docs/news.txt index 488733c..3e47548 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -33,6 +33,13 @@ master than text. Use ``uscript_name`` and ``upath_info`` to get the text version of SCRIPT_NAME and PATH_INFO. +* Don't raise an exception if ``unicode_errors`` or ``decode_param_names`` is + passed to the Request constructor. Instead, emit a warning. For benefit + of Pylons 1.X, which passes both. + +* Don't raise an exception if HTTPException.exception is used; instead emit a + warning. For benefit of Pylons 1.X, which uses it. + 1.2a2 --------- diff --git a/tests/test_exc.py b/tests/test_exc.py index 27161d3..3d533a6 100644 --- a/tests/test_exc.py +++ b/tests/test_exc.py @@ -48,6 +48,7 @@ def test_strip_tags_zaps_tags(): assert_equal(strip_tags('foo<bar>baz</bar>'), 'foobaz') def test_HTTPException(): + import warnings _called = [] _result = object() def _response(environ, start_response): @@ -57,7 +58,9 @@ def test_HTTPException(): start_response = object() exc = HTTPException('testing', _response) ok_(exc.wsgi_response is _response) - assert(exc.exception is exc) + with warnings.catch_warnings(record=True) as w: + assert(exc.exception is exc) + assert(len(w) == 1) result = exc(environ, start_response) ok_(result is result) assert_equal(_called, [(environ, start_response)]) diff --git a/webob/exc.py b/webob/exc.py index 8451251..dd40781 100644 --- a/webob/exc.py +++ b/webob/exc.py @@ -211,7 +211,10 @@ class HTTPException(Exception): # TODO: remove in version 1.3 @property def exception(self): - warn_deprecation("Raise HTTP exceptions directly", '1.3', 2) + warn_deprecation( + "As of WebOb 1.2, raise the HTTPException instance directly " + "instead of raising the result of 'HTTPException.exception'", + '1.3', 2) return self class WSGIHTTPException(Response, HTTPException): |
