diff options
| -rw-r--r-- | paste/printdebug.py | 8 |
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(' ', ' ') + log = self.log_template % text match = self._body_re.search(html) if not match: return log + html |
