diff options
| -rw-r--r-- | docs/glossary.rst | 11 | ||||
| -rw-r--r-- | pyramid/config.py | 20 |
2 files changed, 21 insertions, 10 deletions
diff --git a/docs/glossary.rst b/docs/glossary.rst index c6705fdc5..ccb62bbc8 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -917,3 +917,14 @@ Glossary PyPy is an "alternative implementation of the Python language":http://pypy.org/ + tween + A bit of code that sits between the Pyramid router's main request + handling function and the upstream WSGI component that uses + :app:`Pyramid` as its 'app'. A tween may be used by Pyramid framework + extensions, to provide, for example, Pyramid-specific view timing + support bookkeeping code that examines exceptions before they are + returned to the upstream WSGI application. Tweens behave a bit like + :mod:`WSGI` 'middleware' but they have the benefit of running in a + context in which they have access to the Pyramid :term:`application + registry` as well as the Pyramid rendering machinery. + diff --git a/pyramid/config.py b/pyramid/config.py index 259be7688..b8382e6a7 100644 --- a/pyramid/config.py +++ b/pyramid/config.py @@ -909,16 +909,16 @@ class Configurator(object): @action_method def add_tween(self, tween_factory): """ - Add a 'tween factory'. A 'tween' (think: 'between') is a bit of code - that sits between the Pyramid router's main request handling function - and the upstream WSGI component that uses :app:`Pyramid` as its - 'app'. This is a feature that may be used by framework extensions, - to provide, for example, Pyramid-specific view timing support - bookkeeping code that examines exceptions before they are returned to - the upstream WSGI application. Tweens behave a bit like :mod:`WSGI` - 'middleware' but they have the benefit of running in a context in - which they have access to the Pyramid :term:`application registry` as - well as the Pyramid rendering machinery. + Add a 'tween factory'. A :term`tween` (think: 'between') is a bit of + code that sits between the Pyramid router's main request handling + function and the upstream WSGI component that uses :app:`Pyramid` as + its 'app'. This is a feature that may be used by Pyramid framework + extensions, to provide, for example, Pyramid-specific view timing + support bookkeeping code that examines exceptions before they are + returned to the upstream WSGI application. Tweens behave a bit like + :mod:`WSGI` 'middleware' but they have the benefit of running in a + context in which they have access to the Pyramid :term:`application + registry` as well as the Pyramid rendering machinery. A tween factory (passed as ``tween_factory``) must be a callable (or a :term:`dotted Python name` to such a callable) which accepts two |
