Routes are wrapped function objects that are called upon a HTTP request.
Functions
wrap_response (args[, response_class]) |
Wrap up a response, if applicable. |
Classes
Response ([response, status, headers, ...]) |
Full featured response object implementing the following mixins: |
Route (function[, reverse_hooks, ...]) |
A route object is a wrapped function. |
Rule (string[, defaults, subdomain, methods, ...]) |
A Rule represents one URL pattern. |
Exceptions
HTTPException ([description, response]) |
Baseclass for all HTTP exceptions. |
InternalServerError ([description, response]) |
500 Internal Server Error |
kyoukai.route.
Route
(function, reverse_hooks=False, should_invoke_hooks=True, do_argument_checking=True)[source]¶Bases: object
A route object is a wrapped function. They invoke this function when invoked on routing and calling.
Parameters: |
|
---|
do_argument_checking
= None¶If this route should do argument checking.
rule
= None¶The Rule
associated with this route.
methods
= None¶A list of methods associated with this rule.
hooks
= None¶Our own specific hooks.
create_rule
()[source]¶Creates the rule object used by this route.
Return type: | Rule |
---|---|
Returns: | A new werkzeug.routing.Rule that is to be used for this route. |
invoke_function
(self, ctx, pre_hooks, post_hooks, params)[source]¶Invokes the underlying callable.
This is for use in chaining routes.
:param ctx: The HTTPRequestContext
to use for this route.
:type pre_hooks: list
:param pre_hooks: A list of hooks to call before the route is invoked.
:type post_hooks: list
:param post_hooks: A list of hooks to call after the route is invoked.
:param params: The parameters to pass to the function.
:return: The result of the invoked function.
check_route_args
(params=None)[source]¶Checks the arguments for a route.
Parameters: | params (Optional [dict ]) – The parameters passed in, as a dict. |
---|---|
Raises: | TypeError – If the arguments passed in were not correct. |
add_hook
(type_, hook)[source]¶Adds a hook to the current Route.
Parameters: |
|
---|
get_hooks
(type_)[source]¶Gets the hooks for the current Route for the type.
Parameters: | type (str ) – The type to get. |
---|---|
Returns: | A list of callables. |
invoke
(self, ctx, params=None)[source]¶Invokes a route. This will run the underlying function.
Parameters: |
|
---|---|
Return type: | |
Returns: | The result of the route’s function. |