summaryrefslogtreecommitdiff
path: root/docs/narr/hooks.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/narr/hooks.rst')
-rw-r--r--docs/narr/hooks.rst39
1 files changed, 12 insertions, 27 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index cf3f56e87..b3b41046f 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -70,9 +70,6 @@ Here's some sample code that implements a minimal NotFound view callable:
:exc:`pyramid.exceptions.NotFound` exception instance. If available, the
resource context will still be available as ``request.context``.
-For information about how to configure a not found view via :term:`ZCML`, see
-:ref:`notfound_zcml`.
-
.. index::
single: forbidden view
@@ -83,7 +80,7 @@ Changing the Forbidden View
When :app:`Pyramid` can't authorize execution of a view based on the
:term:`authorization policy` in use, it invokes a :term:`forbidden view`.
-The default forbidden response has a 401 status code and is very plain, but
+The default forbidden response has a 403 status code and is very plain, but
the view which generates it can be overridden as necessary.
The :term:`forbidden view` callable is a view callable like any other. The
@@ -132,15 +129,6 @@ Here's some sample code that implements a minimal forbidden view:
``debug_authorization`` environment setting is true than it is when
it is false.
-.. warning:: the default forbidden view sends a response with a ``401
- Unauthorized`` status code for backwards compatibility reasons.
- You can influence the status code of Forbidden responses by using
- an alternate forbidden view. For example, it would make sense to
- return a response with a ``403 Forbidden`` status code.
-
-For information about how to configure a forbidden view via :term:`ZCML`, see
-:ref:`forbidden_zcml`.
-
.. index::
single: request factory
@@ -185,8 +173,6 @@ already constructed a :term:`configurator` it can also be registered via the
config = Configurator()
config.set_request_factory(MyRequest)
-To use ZCML for the same purpose, see :ref:`changing_request_factory_zcml`.
-
.. index::
single: renderer globals
@@ -242,9 +228,6 @@ already constructed a :term:`configurator` it can also be registered via the
Another mechanism which allows event subscribers to add renderer global values
exists in :ref:`beforerender_event`.
-If you'd rather ZCML to register a renderer globals factory, see
-:ref:`adding_renderer_globals_zcml`.
-
.. index::
single: before render event
@@ -365,10 +348,11 @@ parameter: ``request``. For example:
transaction.commit()
request.add_finished_callback(commit_callback)
-Finished callbacks are called in the order they're added ( first- to
-most-recently- added). Finished callbacks (unlike a :term:`response
-callback`) are *always* called, even if an exception happens in application
-code that prevents a response from being generated.
+Finished callbacks are called in the order they're added
+(first-to-most-recently-added). Finished callbacks (unlike a
+:term:`response callback`) are *always* called, even if an exception
+happens in application code that prevents a response from being
+generated.
The set of finished callbacks associated with a request are called *very
late* in the processing of that request; they are essentially the very last
@@ -474,9 +458,6 @@ when the application :term:`root factory` returned an instance of the
``myapp.resources.MyRoot`` object. Otherwise it would use the default
:app:`Pyramid` traverser to do traversal.
-For information about how to configure an alternate traverser via
-:term:`ZCML`, see :ref:`changing_traverser_zcml`.
-
.. index::
single: url generator
@@ -543,12 +524,14 @@ The default context URL generator is available for perusal as the class
.. index::
single: view mapper
+.. _using_a_view_mapper:
+
Using a View Mapper
-------------------
The default calling conventions for view callables are documented in the
-:ref:`views_chapter`. You can change the way users define view callbles by
-employing a :term:`view mapper`.
+:ref:`views_chapter` chapter. You can change the way users define view
+callbles by employing a :term:`view mapper`.
A view mapper is an object that accepts a set of keyword arguments and which
returns a callable. The returned callable is called with the :term:`view
@@ -609,6 +592,7 @@ A user might make use of these framework components like so:
from webob import Response
from pyramid.config import Configurator
+ import pyramid_handlers
from paste.httpserver import serve
class MyController(BaseController):
@@ -617,6 +601,7 @@ A user might make use of these framework components like so:
if __name__ == '__main__':
config = Configurator()
+ config.include(pyramid_handlers)
config.add_handler('one', '/{id}', MyController, action='index')
config.add_handler('two', '/{action}/{id}', MyController)
serve(config.make_wsgi_app())