Debugging utilities¶
Werkzeug provides excellent debugging features. This module only provides a few wrappers for easier coupling of these features with the Tool API.
- tool.debug.client_factory()¶
Creates and returns a werkzeug.Client instance bound to the application manager. Allows to send requests to the application. Can be used both in automated tests and in the interactive shell.
Usage:
from tool.debug import client_factory c = client_factory() r = c.get('/') print r.data
See Werkzeug documentation, section debug for details.
- tool.debug.print_url_map(url_map)¶
- Pretty-prints given URL map (must be a werkzeug.routing.Map).
- tool.debug.print_wsgi_stack(stack)¶
Pretty-prints an ApplicationManager instance’s current WSGI stack. The list of middleware is printed in the order in which the request/dispatch/response flow actually goes, i.e. ingress (shown in green), URL/view routing (yellow) and egress (blue). The completeness of the list depends on how early the function is called.
Usage:
app_manager = tool.ApplicationManager() app_manager.wrap_in(YourFavouriteMiddleware) print_wsgi_stack(app_manager.wsgi_stack)