summaryrefslogtreecommitdiff
path: root/paste/printdebug.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-12-14 21:55:47 +0000
committerianb <devnull@localhost>2005-12-14 21:55:47 +0000
commite2d3bd09267fec92406b1a4bd548f40dc4fa8137 (patch)
tree12e04cd0901561316eb12e30b5cdae55d3f0e7d7 /paste/printdebug.py
parentdc9ad0dd63329974cc674baf5c423c5dd9d070f3 (diff)
downloadpaste-e2d3bd09267fec92406b1a4bd548f40dc4fa8137.tar.gz
Moved printdebug to use intercept_output
Diffstat (limited to 'paste/printdebug.py')
-rw-r--r--paste/printdebug.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/paste/printdebug.py b/paste/printdebug.py
index e44b33b..973322e 100644
--- a/paste/printdebug.py
+++ b/paste/printdebug.py
@@ -62,8 +62,8 @@ class PrintDebugMiddleware(object):
output = StringIO()
try:
threadedprint.register(replacement_stdout)
- status, headers, body = wsgilib.capture_output(
- environ, start_response, self.app)
+ status, headers, body = wsgilib.intercept_output(
+ environ, self.app)
if status is None:
# Some error occurred
status = '500 Server Error'
@@ -78,8 +78,11 @@ class PrintDebugMiddleware(object):
if replacement_stdout == logged:
# Then the prints will be lost, unless...
environ['wsgi.errors'].write(logged.getvalue())
+ start_response(status, headers)
return [body]
+ wsgilib.remove_header(headers, 'content-length')
body = self.add_log(body, logged.getvalue())
+ start_response(status, headers)
return [body]
finally:
threadedprint.deregister()