diff options
-rw-r--r-- | docs/news.txt | 9 | ||||
-rw-r--r-- | paste/errordocument.py | 47 | ||||
-rw-r--r-- | setup.py | 1 | ||||
-rw-r--r-- | tests/test_errordocument.py | 14 |
4 files changed, 8 insertions, 63 deletions
diff --git a/docs/news.txt b/docs/news.txt index a438df1..4ceb87d 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -1,9 +1,9 @@ -NEWS +News ==== .. contents:: -0.9.4 +0.9.5 ----- * Fixed a security vulnerability in ``paste.urlparser``'s StaticURLParser @@ -70,6 +70,11 @@ NEWS the ``cgi`` module read from ``wsgi.input`` when there are no parsable variables in the input (based on ``CONTENT_TYPE``). +0.9.4 +----- + +* This released was lost in a tragic clerical accident. + 0.9.3 ----- diff --git a/paste/errordocument.py b/paste/errordocument.py index 0a44a3e..b376fea 100644 --- a/paste/errordocument.py +++ b/paste/errordocument.py @@ -329,50 +329,3 @@ def make_errordocument(app, global_conf, **kw): forwarder = forward(app, map) return forwarder - -def make_empty_error(app, global_conf, **kw): - """ - Use like: - - [filter-app:main] - use = egg:Paste#emptyerror - next = real-app - - This will clear the body of any bad responses (e.g., 404, 500, - etc). If running behind Apache, Apache will replace the empty - response with whatever its configured ``ErrorDocument`` (but - Apache doesn't overwrite responses that do have content, which is - why this middlware is necessary) - """ - if kw: - raise ValueError( - 'emptyerror does not take any configuration') - return empty_error(app) - -def empty_error(app): - def filtered_app(environ, start_response): - got_status = [] - def replace_start_response(status, headers, exc_info=None): - got_status.append(status) - return start_response(status, headers, exc_info) - app_iter = app(environ, replace_start_response) - item1 = None - if not got_status: - item1 = '' - for item in app_iter: - item1 = item - break - if not got_status: - raise ValueError( - "start_response not called from application") - status = int(got_status[0].split()[0]) - if status >= 400: - if hasattr(app_iter, 'close'): - app_iter.close() - return [''] - else: - if item1 is not None: - return chained_app_iters([item1], app_iter) - else: - return app_iter - return filtered_app @@ -174,7 +174,6 @@ For the latest changes see the `news file recorder = paste.debug.recorder.record:make_recorder pony = paste.pony:make_pony errordocument = paste.errordocument:make_errordocument - emptyerror = paste.errordocument:make_empty_error [paste.server_runner] http = paste.httpserver:server_runner diff --git a/tests/test_errordocument.py b/tests/test_errordocument.py index 51135b6..502b44d 100644 --- a/tests/test_errordocument.py +++ b/tests/test_errordocument.py @@ -14,7 +14,7 @@ I also need to find out how to test that another response was correctly requested by the middleware. """ import os -from paste.errordocument import forward, custom_forward, empty_error +from paste.errordocument import forward, custom_forward from paste.fixture import * def simple_app(environ, start_response): @@ -31,15 +31,3 @@ def test_ok(): assert res.header('content-type') == 'text/plain' assert res.full_status == '200 OK' assert 'requested page returned' in res - -def test_empty(): - app = TestApp(empty_error(simple_app)) - res = app.get('/') - assert res.header('content-type') == 'text/plain' - assert res.full_status == '200 OK' - assert 'requested page returned' in res - app = TestApp(empty_error(not_found_app)) - res = app.get('/', status=404) - assert 'requested page returned' not in res - assert res.body == '' - assert res.status == 404 |