diff options
| author | Chris McDonough <chrism@plope.com> | 2015-06-05 14:06:02 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2015-06-05 14:06:02 -0400 |
| commit | f3c67a4217504bc7f2862ec1616342240738efae (patch) | |
| tree | 9e7452b3ffdc8d4f30739cfc9d898169d6719206 /docs/narr/viewconfig.rst | |
| parent | 7b4ed3088af03de473ad164c314062c283afce39 (diff) | |
| parent | c1dbb5092d486df5d7fbad8e52cd1dbcc2c834d9 (diff) | |
| download | pyramid-f3c67a4217504bc7f2862ec1616342240738efae.tar.gz pyramid-f3c67a4217504bc7f2862ec1616342240738efae.tar.bz2 pyramid-f3c67a4217504bc7f2862ec1616342240738efae.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/narr/viewconfig.rst')
| -rw-r--r-- | docs/narr/viewconfig.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst index d5203c6ba..fc5ae6dc6 100644 --- a/docs/narr/viewconfig.rst +++ b/docs/narr/viewconfig.rst @@ -234,6 +234,21 @@ Non-Predicate Arguments def myview(request): ... + All view callables in the decorator chain must return a response object + implementing :class:`pyramid.interfaces.IResponse` or raise an exception: + + .. code-block:: python + + def log_timer(wrapped): + def wrapper(context, request): + start = time.time() + response = wrapped(context, request) + duration = time.time() - start + response.headers['X-View-Time'] = '%.3f' % (duration,) + log.info('view took %.3f seconds', duration) + return response + return wrapper + ``mapper`` A Python object or :term:`dotted Python name` which refers to a :term:`view mapper`, or ``None``. By default it is ``None``, which indicates that the |
