This class is the interface between ToscaWidgets and the framework or web application that’s using them.
The an instance of this class should be passed as second argument to tw.core.middleware.ToscaWidgetsMiddleware which will call its start_request() method at the beginning of every request and end_request() when the request is over so I have a chance to register our per-request context.
A request-local proxy to a configured instance is placed at the beginning of the request at tw.framework
Enables runtime checks for possible programming errors regarding modifying widget attributes once a widget has been initialized. Disabling this option can significantly reduce Widget initializatio time.
This operation modifies the Widget class and will affect any application using ToscaWidgets in the same process.
This option can either be None, or must be a dictionary. The dictionary can have two keys, js and css. The value of each key is a list of dicts with the following keys:
- modname the module to create the resource link from.
- filename the filename relative to the modname of the aggregated resources.
- map the mapping-file for the aggregated resources. If not given, defaults to <filename>.map.
Track an object instance internally using a stack
The StackedObjectProxy proxies access to an object internally using a stacked thread-local. This makes it safe for complex WSGI environments where access to the object may be desired in multiple places without having to pass the actual object around.
New objects are added to the top of the stack with _push_object while objects can be removed with _pop_object.