summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-08-06 17:41:30 -0400
committerChris McDonough <chrism@plope.com>2011-08-06 17:41:30 -0400
commitdc7122f8bb5033d0cd0e95f5adfa66c4499f140e (patch)
tree30ad3bef5b90b8ca15441627da24f9b9ad68a39e
parentb4843bc087524320460fb3fca9d33688cafa0dbb (diff)
downloadpyramid-dc7122f8bb5033d0cd0e95f5adfa66c4499f140e.tar.gz
pyramid-dc7122f8bb5033d0cd0e95f5adfa66c4499f140e.tar.bz2
pyramid-dc7122f8bb5033d0cd0e95f5adfa66c4499f140e.zip
add glossary entry for tween
-rw-r--r--docs/glossary.rst11
-rw-r--r--pyramid/config.py20
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