diff options
| author | ianb <devnull@localhost> | 2005-08-31 21:33:10 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-08-31 21:33:10 +0000 |
| commit | 1902e5029e67c8008f4f4638ef1a507c45236bf2 (patch) | |
| tree | b1c09a34c631cc239ad38c8665522d9b6f7015d9 | |
| parent | dfc0c4aad012ab8adac9b577abc25b9f5f4a0b77 (diff) | |
| download | paste-1902e5029e67c8008f4f4638ef1a507c45236bf2.tar.gz | |
Removed old configuration code
| -rw-r--r-- | paste/printdebug.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/paste/printdebug.py b/paste/printdebug.py index a801f72..381c831 100644 --- a/paste/printdebug.py +++ b/paste/printdebug.py @@ -7,6 +7,7 @@ import re import cgi from paste.util import threadedprint from paste import wsgilib +from paste.deploy.converters import asbool _threadedprint_installed = False @@ -26,12 +27,7 @@ class PrintDebugMiddleware(object): """ This middleware captures all the printed statements, and inlines them in HTML pages, so that you can see all the (debug-intended) - print statements in the page itself. Install like:: - - important_middleware.append( - 'paste.printdebug.PrintDebugMiddleware') - - In your configuration file. + print statements in the page itself. """ log_template = ( @@ -40,9 +36,11 @@ class PrintDebugMiddleware(object): '<b style="border-bottom: 1px solid #000">Log messages</b><br>' '%s</pre>') - def __init__(self, app, global_conf=None, force_content_type=False): + def __init__(self, app, global_conf=None, force_content_type=False, + print_wsgi_errors=True): self.app = app self.force_content_type = force_content_type + self.print_wsgi_errors = asbool(print_wsgi_errors) def __call__(self, environ, start_response): global _threadedprint_installed @@ -51,9 +49,8 @@ class PrintDebugMiddleware(object): _threadedprint_installed = True threadedprint.install(leave_stdout=True) logged = StringIO() - if environ['paste.config'].get('printdebug_print_error'): + if self.print_wsgi_errors: replacement_stdout = TeeFile(environ['wsgi.errors'], logged) - environ['paste.config']['show_exceptions_in_error_log'] = False else: replacement_stdout = logged output = StringIO() |
