summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2016-11-19 00:05:07 -0600
committerMichael Merickel <michael@merickel.org>2016-11-19 00:07:41 -0600
commit663c2648e2a946f44eeec0e490effb2ebdb8a11c (patch)
treefca66b5cd8d86ce2cbae756b7c22470681ec056b
parent8dfcfb9cf823175bb91ba39565524ff95a920809 (diff)
downloadpyramid-663c2648e2a946f44eeec0e490effb2ebdb8a11c.tar.gz
pyramid-663c2648e2a946f44eeec0e490effb2ebdb8a11c.tar.bz2
pyramid-663c2648e2a946f44eeec0e490effb2ebdb8a11c.zip
improve view decorator return type documentation
Fixes #2770.
-rw-r--r--docs/narr/viewconfig.rst8
-rw-r--r--pyramid/config/views.py8
2 files changed, 10 insertions, 6 deletions
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index 7cb8e0306..3b683ff79 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -252,7 +252,7 @@ Non-Predicate Arguments
def myview(request):
...
- Is similar to doing::
+ Is similar to decorating the view callable directly::
@view_config(...)
@decorator2
@@ -260,8 +260,10 @@ 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:
+ An important distinction is that each decorator will receive a response
+ object implementing :class:`pyramid.interfaces.IResponse` instead of the
+ raw value returned from the view callable. All decorators in the chain must
+ return a response object or raise an exception:
.. code-block:: python
diff --git a/pyramid/config/views.py b/pyramid/config/views.py
index acdc00704..6082d8b48 100644
--- a/pyramid/config/views.py
+++ b/pyramid/config/views.py
@@ -444,9 +444,11 @@ class ViewsConfiguratorMixin(object):
think about preserving function attributes such as ``__name__`` and
``__module__`` within decorator logic).
- All view callables in the decorator chain must return a response
- object implementing :class:`pyramid.interfaces.IResponse` or raise
- an exception:
+ An important distinction is that each decorator will receive a
+ response object implementing :class:`pyramid.interfaces.IResponse`
+ instead of the raw value returned from the view callable. All
+ decorators in the chain must return a response object or raise an
+ exception:
.. code-block:: python