beaker.middleware – Middleware classes

Module Contents

class beaker.middleware.CacheMiddleware(app, config=None, environ_key='beaker.cache', **kwargs)

Initialize the Cache Middleware

The Cache middleware will make a CacheManager instance available every request under the environ['beaker.cache'] key by default. The location in environ can be changed by setting environ_key.

config
dict All settings should be prefixed by ‘cache.’. This method of passing variables is intended for Paste and other setups that accumulate multiple component settings in a single dictionary. If config contains no cache. prefixed args, then all of the config options will be used to intialize the Cache objects.
environ_key
Location where the Cache instance will keyed in the WSGI environ
**kwargs
All keyword arguments are assumed to be cache settings and will override any settings found in config
class beaker.middleware.SessionMiddleware(wrap_app, config=None, environ_key='beaker.session', **kwargs)

Initialize the Session Middleware

The Session middleware will make a lazy session instance available every request under the environ['beaker.session'] key by default. The location in environ can be changed by setting environ_key.

config
dict All settings should be prefixed by ‘session.’. This method of passing variables is intended for Paste and other setups that accumulate multiple component settings in a single dictionary. If config contains no cache. prefixed args, then all of the config options will be used to intialize the Cache objects.
environ_key
Location where the Session instance will keyed in the WSGI environ
**kwargs
All keyword arguments are assumed to be session settings and will override any settings found in config