Ian Bicking  committed 46763a1

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:

  • Participants
  • Parent commits 7d61619
  • Branches default

Comments (0)

Files changed (1)

File paste/

 import warnings
+import sys
 from urlparse import urlparse
 from paste.recursive import ForwardRequestException, RecursiveMiddleware, RecursionLoop
 from paste.util import converters
             return, 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]
     def __call__(self, environ, start_response):
         url = []
+        writer = []
         def change_response(status, headers, exc_info=None):
             status_code = status.split(' ')
                 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
                 return start_response(status, headers, exc_info)