module documentation

Functions that help with dynamically creating decorators for views.

Class classonlymethod Undocumented
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 make_middleware_decorator Undocumented
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.
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
def async_only_middleware(func): (source)

Mark a middleware factory as returning an async middleware.

def decorator_from_middleware(middleware_class): (source)

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): (source)

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 make_middleware_decorator(middleware_class): (source)

Undocumented

def method_decorator(decorator, name=''): (source)

Convert a function decorator into a method decorator

def sync_and_async_middleware(func): (source)

Mark a middleware factory as returning a hybrid middleware supporting both types of request.

def sync_only_middleware(func): (source)

Mark a middleware factory as returning a sync middleware. This is the default.

def _multi_decorate(decorators, method): (source)

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): (source)

Undocumented