Middleware

Warning

The following classes should not be called directly.

MiddlewareController

class dragonfly.middleware.middleware_controller.MiddlewareController

Bases: object

Loads all registered middleware and controls their execution.

run_after(action, response)

Run all the after methods on the middleware that are assigned to the given action.

Parameters:
  • action (str) – The action currently being executed.
  • response (Response) – The Response that the router has generated. If the ‘after’ function accepts the Response class it is passed on (to allow for its modification).
Returns:

If a Response is generated return this

Return type:

Response

run_before(action)

Run all the before methods on middleware that are assigned to the given action.

Parameters:action (str) – The action currently being executed.
Returns:If a Response is generated return this
Return type:Response