diff options
| author | Chris McDonough <chrism@plope.com> | 2017-02-17 20:38:40 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2017-02-17 20:38:40 -0500 |
| commit | b2e8884a94d9e869bf29ea55298ad308f16ed420 (patch) | |
| tree | e46bf79d1a8811ad273a40ce194d05836fcc7409 /docs/narr/hooks.rst | |
| parent | 7bb06f28ee296ecf43ba63279fc4c2439b4571d3 (diff) | |
| parent | 40d71e805bfcf8522c6af71995c05c496f1c4b4f (diff) | |
| download | pyramid-b2e8884a94d9e869bf29ea55298ad308f16ed420.tar.gz pyramid-b2e8884a94d9e869bf29ea55298ad308f16ed420.tar.bz2 pyramid-b2e8884a94d9e869bf29ea55298ad308f16ed420.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/narr/hooks.rst')
| -rw-r--r-- | docs/narr/hooks.rst | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index b22b31bf9..63279027a 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -116,14 +116,6 @@ callable: .. note:: - Both :meth:`pyramid.config.Configurator.add_notfound_view` and - :class:`pyramid.view.notfound_view_config` are new as of Pyramid 1.3. - Older Pyramid documentation instructed users to use ``add_view`` instead, - with a ``context`` of ``HTTPNotFound``. This still works; the convenience - method and decorator are just wrappers around this functionality. - -.. warning:: - When a Not Found View callable accepts an argument list as described in :ref:`request_and_context_view_definitions`, the ``context`` passed as the first argument to the view callable will be the @@ -131,6 +123,13 @@ callable: available, the resource context will still be available as ``request.context``. +.. warning:: + + The :term:`Not Found View` callables are only invoked when a + :exc:`~pyramid.httpexceptions.HTTPNotFound` exception is raised. If the + exception is returned from a view then it will be treated as a regular + response object and it will not trigger the custom view. + .. index:: single: forbidden view @@ -161,7 +160,7 @@ forbidden view: def main(globals, **settings): config = Configurator() - config.add_forbidden_view(forbidden_view) + config.add_forbidden_view(forbidden) If instead you prefer to use decorators and a :term:`scan`, you can use the :class:`pyramid.view.forbidden_view_config` decorator to mark a view callable @@ -210,6 +209,13 @@ Here's some sample code that implements a minimal forbidden view: whether the ``pyramid.debug_authorization`` environment setting is true or false. +.. warning:: + + The :term:`forbidden view` callables are only invoked when a + :exc:`~pyramid.httpexceptions.HTTPForbidden` exception is raised. If the + exception is returned from a view then it will be treated as a regular + response object and it will not trigger the custom view. + .. index:: single: request factory @@ -744,7 +750,9 @@ The API that must be implemented by a class that provides """ Accept the resource and request and set self.physical_path and self.virtual_path """ self.virtual_path = some_function_of(resource, request) + self.virtual_path_tuple = some_function_of(resource, request) self.physical_path = some_other_function_of(resource, request) + self.physical_path_tuple = some_function_of(resource, request) The default context URL generator is available for perusal as the class :class:`pyramid.traversal.ResourceURL` in the `traversal module |
