Skip to content

Commit

Permalink
improve view decorator return type documentation
Browse files Browse the repository at this point in the history
Fixes #2770.
  • Loading branch information
mmerickel committed Nov 19, 2016
1 parent 4df3c31 commit 8f6d451
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions docs/narr/viewconfig.rst
Expand Up @@ -252,16 +252,18 @@ Non-Predicate Arguments
def myview(request):
...

Is similar to doing::
Is similar to decorating the view callable directly::

@view_config(...)
@decorator2
@decorator1
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
Expand Down
8 changes: 5 additions & 3 deletions pyramid/config/views.py
Expand Up @@ -444,9 +444,11 @@ def myview(request):
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
Expand Down

0 comments on commit 8f6d451

Please sign in to comment.