Robert Jackiewicz
2012-11-12 ce9bb7750bd97ae7b986a789d37a2b0b9e019699
backport of #720 to describe context in exception views

Conflicts:
CONTRIBUTORS.txt
2 files modified
15 ■■■■■ changed files
CONTRIBUTORS.txt 2 ●●●●● patch | view | raw | blame | history
docs/narr/hooks.rst 13 ●●●●● patch | view | raw | blame | history
CONTRIBUTORS.txt
@@ -166,3 +166,5 @@
- Paul M. Winkler, 2012/02/22
- Martijn Pieters, 2012/03/02
- Robert Jackiewicz, 2012/11/12
docs/narr/hooks.rst
@@ -180,11 +180,14 @@
      config.scan()
Like any other view, the forbidden view must accept at least a ``request``
parameter, or both ``context`` and ``request``.  The ``context`` (available
as ``request.context`` if you're using the request-only view argument
pattern) is the context found by the router when the view invocation was
denied.  The ``request`` is the current :term:`request` representing the
denied action.
parameter, or both ``context`` and ``request``.  If a forbidden view
callable accepts both ``context`` and ``request``, the HTTP Exception is passed
as context. The ``context`` as found by the router when view was
denied (that you normally would expect) is available as
``request.context``.  The ``request`` is the  current :term:`request`
representing the denied action.
Here's some sample code that implements a minimal forbidden view: