tw.core.middleware

ToscaWidgetsMiddleware

class tw.core.middleware.ToscaWidgetsMiddleware(application, host_framework, prefix='/toscawidgets', inject_resources=True, serve_resources=True, require_once=False, render_filter=None, callback_security_default=<function always_deny at 0xb74fa6bc>)

This WSGI middleware piece takes care of creating a per-request context for ToscaWidgets and injecting resource links into html responses.

It can also take care of serving those resources if serve_resources is True (default).

make_middleware()

tw.core.middleware.make_middleware(app, config=None, **kw)

Initializes tw.core.middleware.ToscaWidgetsMiddleware and a tw.mods.base.HostFramework and wraps the WSGI application app with it.

Configuration can be passed in a dict as the config parameter.

Available options:

toscawidgets.middleware.*
These parameters will be passed to tw.core.middleware.ToscaWidgetsMiddleware when instatntiating it. See its docstrings for details.
toscawidgets.framework
Name of the toscawidgets.host_frameworks entry point or tw.mods.base.HostFramework subclass which shall interface with the framework. wsgi, pylons are available. Default is wsgi
toscawidgets.framework.*
Parameters for the tw.modes.base.HostFramework. See their respective docstrings for accepted parameters.

This is the ToscaWidgets#middleware paste.filter_app_factory entrypoint.