paste.debug.prints
– capture print output¶
Middleware that displays everything that is printed inline in application pages.
Anything printed during the request will get captured and included on the page. It will usually be included as a floating element in the top right hand corner of the page. If you want to override this you can include a tag in your template where it will be placed:
<pre id="paste-debug-prints"></pre>
You might want to include style="white-space: normal"
, as all the
whitespace will be quoted, and this allows the text to wrap if
necessary.
Module Contents¶
- class paste.debug.prints.PrintDebugMiddleware(app, global_conf=None, force_content_type=False, print_wsgi_errors=True, replace_stdout=False)¶
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.
There are two keys added to the environment to control this:
environ['paste.printdebug_listeners']
is a list of functions that will be called everytime something is printed.environ['paste.remove_printdebug']
is a function that, if called, will disable printing of output for that request.If you have
replace_stdout=True
then stdout is replaced, not captured.