Package translate :: Package misc :: Module selector :: Class MiddlewareComposer |
[hide private]
[frames] | no frames]

# Class MiddlewareComposer

source code

Compose middleware based on list of rules.

Instance Methods | [hide private]
__init__(self, app, rules) Instantiate with an app and a list of rules. | source code
__call__(self, environ, start_response) Apply each middleware whose predicate is true. | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, app, rules) (Constructor) | source code
Instantiate with an app and a list of rules. Overrides: object.__init__

### __call__(self, environ, start_response) (Call operator) | source code
Apply each middleware whose predicate is true. Each predicate is passes the environ to evaluate. Given this set of rules: t = lambda x: True; f = lambda x: False [(t, a), (f, b), (t, c), (f, d), (t, e)] The app composed would be equivalent to this: a(c(e(app)))