summaryrefslogtreecommitdiff
path: root/paste/errordocument.py
diff options
context:
space:
mode:
authorIan Bicking <ianb@colorstudy.com>2010-09-02 02:40:17 -0500
committerIan Bicking <ianb@colorstudy.com>2010-09-02 02:40:17 -0500
commit2f5bbe61d249b3c8884072d33047ad7522dd8068 (patch)
treef0db9b31f683a560d79207028091f50121fb41f7 /paste/errordocument.py
parent1ce1c1c216aaf5b90102be554df6c4f99c797006 (diff)
downloadpaste-2f5bbe61d249b3c8884072d33047ad7522dd8068.tar.gz
Always return something from start_response, even if we don't plan to actually use the written response (because it will be forwarded). Might fix: http://trac.pythonpaste.org/pythonpaste/ticket/166
Diffstat (limited to 'paste/errordocument.py')
-rw-r--r--paste/errordocument.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/paste/errordocument.py b/paste/errordocument.py
index d3d35bb..e57c162 100644
--- a/paste/errordocument.py
+++ b/paste/errordocument.py
@@ -10,6 +10,7 @@ URL where the content can be displayed to the user as an error document.
"""
import warnings
+import sys
from urlparse import urlparse
from paste.recursive import ForwardRequestException, RecursiveMiddleware, RecursionLoop
from paste.util import converters
@@ -85,7 +86,7 @@ class StatusKeeper(object):
return self.app(environ, keep_status_start_response)
except RecursionLoop, e:
environ['wsgi.errors'].write('Recursion error getting error page: %s\n' % e)
- keep_status_start_response('500 Server Error', [('Content-type', 'text/plain')])
+ keep_status_start_response('500 Server Error', [('Content-type', 'text/plain')], sys.exc_info())
return ['Error: %s. (Error page could not be fetched)'
% self.status]
@@ -160,6 +161,7 @@ class StatusBasedForward(object):
def __call__(self, environ, start_response):
url = []
+ writer = []
def change_response(status, headers, exc_info=None):
status_code = status.split(' ')
@@ -182,10 +184,12 @@ class StatusBasedForward(object):
raise TypeError(
'Expected the url to internally '
'redirect to in the StatusBasedForward mapper'
- 'to be a string or None, not %s'%repr(new_url)
- )
+ 'to be a string or None, not %r' % new_url)
if new_url:
url.append([new_url, status, headers])
+ # We have to allow the app to write stuff, even though
+ # we'll ignore it:
+ return [].append
else:
return start_response(status, headers, exc_info)