Request¶
Adding request methods¶
-
Application.
add_request_attribute
(attr, name=None, decorator=None, reify=False)[source]¶ Add dynamic attribute to requests.
This is mainly intended so that extensions can easily add request methods and properties.
Functions can already be decorated, or a
decorator
can be specified. Ifreify
isTrue
, the function will be decorated withtangled.decorators.cached_property()
. If adecorator
is passed andreify
isTrue
,cached_property
will be applied as the outermost decorator.
Request factories¶
These two methods make it easy to create properly configured requests. In
particular, they set the request’s app
attribute, and they create
request instances with the attributes added via
tangled.web.app.Application.add_request_attribute()
.