class documentation

class LocalManager:

View In Hierarchy

Local objects cannot manage themselves. For that you need a local manager. You can pass a local manager multiple locals or add them later by appending them to manager.locals. Every time the manager cleans up, it will clean up all the data left in the locals for this context.

Changed in version 2.0: ident_func is deprecated and will be removed in Werkzeug 2.1.
Changed in version 0.6.1: The release_local function can be used instead of a manager.
Changed in version 0.7: The ident_func parameter was added.
Method __init__ Undocumented
Method __repr__ Undocumented
Method cleanup Manually clean up the data in the locals for this context. Call this at the end of the request or use make_middleware().
Method get​_ident No summary
Method ident​_func.setter Undocumented
Method make​_middleware Wrap a WSGI application so that cleaning up happens after request end.
Method middleware Like make_middleware but for decorating functions.
Instance Variable locals Undocumented
Property ident​_func Undocumented
def __init__(self, locals=None, ident_func=None):

Undocumented

Parameters
locals:t.Optional[t.Iterable[t.Union[Local, LocalStack]]]Undocumented
ident​_func:NoneUndocumented
def __repr__(self):

Undocumented

Returns
strUndocumented
def cleanup(self):
Manually clean up the data in the locals for this context. Call this at the end of the request or use make_middleware().
def get_ident(self):

Return the context identifier the local objects use internally for this context. You cannot override this method to change the behavior but use it to link other context local objects (such as SQLAlchemy's scoped sessions) to the Werkzeug locals.

Deprecated since version 2.0: Will be removed in Werkzeug 2.1.
Changed in version 0.7: You can pass a different ident function to the local manager that will then be propagated to all the locals passed to the constructor.
Returns
intUndocumented
@ident_func.setter
def ident_func(self, func):

Undocumented

Parameters
func:t.Callable[[], int]Undocumented
def make_middleware(self, app):
Wrap a WSGI application so that cleaning up happens after request end.
Parameters
app:WSGIApplicationUndocumented
Returns
WSGIApplicationUndocumented
def middleware(self, func):

Like make_middleware but for decorating functions.

Example usage:

@manager.middleware
def application(environ, start_response):
    ...

The difference to make_middleware is that the function passed will have all the arguments copied from the inner application (name, docstring, module).

Parameters
func:WSGIApplicationUndocumented
Returns
WSGIApplicationUndocumented
locals: list =

Undocumented

@property
ident_func: t.Callable[[], int] =

Undocumented