diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-10-10 02:30:50 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-10-10 02:30:50 +0000 |
| commit | ce8f9b5eadf324b4cc3154004bcf9f1f03e7d6c8 (patch) | |
| tree | 6dd39091d8e27561541a9ed8ea4f1d0d54b4298f /docs | |
| parent | 048496dbbbbd6679afca52387ddbea2aefd596dd (diff) | |
| download | pyramid-ce8f9b5eadf324b4cc3154004bcf9f1f03e7d6c8.tar.gz pyramid-ce8f9b5eadf324b4cc3154004bcf9f1f03e7d6c8.tar.bz2 pyramid-ce8f9b5eadf324b4cc3154004bcf9f1f03e7d6c8.zip | |
- The ``notfound`` and ``forbidden`` ZCML directives now accept the
following addtional attributes: ``attr``, ``renderer``, and
``wrapper``. These have the same meaning as they do in the context
of a ZCML ``view`` directive.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/hooks.rst | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 65e21d3f2..42d354c89 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -40,6 +40,44 @@ implements a minimal NotFound view: This error will be different when the ``debug_notfound`` environment setting is true than it is when it is false. +Other available attributes of the ``notfound`` ZCML directive are as +follows: + +attr + + The attribute of the view callable to use if ``__call__`` is not + correct (has the same meaning as in the context of + :ref:`the_view_zcml_directive`; see the description of ``attr`` + there). + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + +renderer + + This is either a single string term (e.g. ``json``) or a string + implying a path or :term:`resource specification` + (e.g. ``templates/views.pt``) used when the view returns a + non-:term:`response` object. This attribute has the same meaning as + it would in the context of :ref:`the_view_zcml_directive`; see the + description of ``renderer`` there). + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + +wrapper + + The :term:`view name` (*not* an object dotted name) of another view + declared elsewhere in ZCML (or via the ``@bfg_view`` decorator) + which will receive the response body of this view as the + ``request.wrapped_body`` attribute of its own request, and the + response returned by this view as the ``request.wrapped_response`` + attribute of its own request. This attribute has the same meaning + as it would in the context of :ref:`the_view_zcml_directive`; see + the description of ``wrapper`` there). Note that the wrapper view + *should not* be protected by any permission; behavior is undefined + if it does. + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + .. _changing_the_forbidden_view: Changing the Forbidden View @@ -86,6 +124,45 @@ code that implements a minimal forbidden view: an alternate forbidden view. For example, it would make sense to return a response with a ``403 Forbidden`` status code. +Other available attributes of the ``forbidden`` ZCML directive are as +follows: + +attr + + The attribute of the view callable to use if ``__call__`` is not + correct (has the same meaning as in the context of + :ref:`the_view_zcml_directive`; see the description of ``attr`` + there). + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + +renderer + + This is either a single string term (e.g. ``json``) or a string + implying a path or :term:`resource specification` + (e.g. ``templates/views.pt``) used when the view returns a + non-:term:`response` object. This attribute has the same meaning as + it would in the context of :ref:`the_view_zcml_directive`; see the + description of ``renderer`` there). + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + +wrapper + + The :term:`view name` (*not* an object dotted name) of another view + declared elsewhere in ZCML (or via the ``@bfg_view`` decorator) + which will receive the response body of this view as the + ``request.wrapped_body`` attribute of its own request, and the + response returned by this view as the ``request.wrapped_response`` + attribute of its own request. This attribute has the same meaning + as it would in the context of :ref:`the_view_zcml_directive`; see + the description of ``wrapper`` there). Note that the wrapper view + *should not* be protected by any permission; behavior is undefined + if it does. + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + + Changing the response factory ----------------------------- |
