Commits

Anonymous committed c62a4d0

Removed errordocument.empty_error, since it never actually worked in a useful way; changed the news to 0.9.5 (since that's what the next release will be)

Comments (0)

Files changed (4)

-NEWS
+News
 ====
 
 .. contents::
 
-0.9.4
+0.9.5
 -----
 
 * Fixed a security vulnerability in ``paste.urlparser``'s StaticURLParser
   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
 -----
 

paste/errordocument.py

     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
       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

tests/test_errordocument.py

 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):
     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