module documentation

Functions that help with dynamically creating decorators for views.
Function async​_only​_middleware Mark a middleware factory as returning an async middleware.
Function decorator​_from​_middleware Given a middleware class (not an instance), return a view decorator. This lets you use middleware functionality on a per-view basis. The middleware is created with no params passed.
Function decorator​_from​_middleware​_with​_args Like decorator_from_middleware, but return a function that accepts the arguments to be passed to the middleware_class. Use like:
Function method​_decorator Convert a function decorator into a method decorator
Function sync​_and​_async​_middleware Mark a middleware factory as returning a hybrid middleware supporting both types of request.
Function sync​_only​_middleware Mark a middleware factory as returning a sync middleware. This is the default.
Class classonlymethod Undocumented
Function ​_multi​_decorate Decorate method with one or more function decorators. decorators can be a single decorator or an iterable of decorators.
Function ​_update​_method​_wrapper Undocumented
Function make​_middleware​_decorator Undocumented
def async_only_middleware(func):
Mark a middleware factory as returning an async middleware.
def decorator_from_middleware(middleware_class):
Given a middleware class (not an instance), return a view decorator. This lets you use middleware functionality on a per-view basis. The middleware is created with no params passed.
def decorator_from_middleware_with_args(middleware_class):

Like decorator_from_middleware, but return a function that accepts the arguments to be passed to the middleware_class. Use like:

cache_page = decorator_from_middleware_with_args(CacheMiddleware)
# ...

@cache_page(3600)
def my_view(request):
    # ...
def method_decorator(decorator, name=''):
Convert a function decorator into a method decorator
def sync_and_async_middleware(func):
Mark a middleware factory as returning a hybrid middleware supporting both types of request.
def sync_only_middleware(func):
Mark a middleware factory as returning a sync middleware. This is the default.
def _multi_decorate(decorators, method):
Decorate method with one or more function decorators. decorators can be a single decorator or an iterable of decorators.
def _update_method_wrapper(_wrapper, decorator):

Undocumented

def make_middleware_decorator(middleware_class):

Undocumented