summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-07-21 21:16:23 +0000
committerianb <devnull@localhost>2005-07-21 21:16:23 +0000
commitcda264651026af6236a7e402b10bbef9457d40cf (patch)
treef2a50af2d761a97ab6c0ae4c00832cffd82339e5 /paste
parentd7e6f5ea7716050634663318e2be79f58fd5f150 (diff)
downloadpaste-cda264651026af6236a7e402b10bbef9457d40cf.tar.gz
Allow word wrapping; try to keep exceptions out of printed output
Diffstat (limited to 'paste')
-rw-r--r--paste/printdebug.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/paste/printdebug.py b/paste/printdebug.py
index 280356f..56ac28e 100644
--- a/paste/printdebug.py
+++ b/paste/printdebug.py
@@ -32,7 +32,7 @@ class PrintDebugMiddleware(object):
"""
log_template = (
- '<pre style="width: 40%%; border: 2px solid #000; '
+ '<pre style="width: 40%%; border: 2px solid #000; white-space: normal; '
'background-color: #ffd; color: #000; float: right;">'
'<b style="border-bottom: 1px solid #000">Log messages</b><br>'
'%s</pre>')
@@ -49,6 +49,7 @@ class PrintDebugMiddleware(object):
logged = StringIO()
if environ['paste.config'].get('printdebug_print_error'):
replacement_stdout = TeeFile(environ['wsgi.errors'], logged)
+ environ['paste.config']['show_exceptions_in_error_log'] = False
else:
replacement_stdout = logged
output = StringIO()
@@ -79,7 +80,10 @@ class PrintDebugMiddleware(object):
def add_log(self, html, log):
if not log:
return html
- log = self.log_template % cgi.escape(log)
+ text = cgi.escape(log)
+ text = text.replace('\n', '<br>\n')
+ text = text.replace(' ', '&nbsp; ')
+ log = self.log_template % text
match = self._body_re.search(html)
if not match:
return log + html