summaryrefslogtreecommitdiff
path: root/docs/narr/hooks.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-06-11 03:15:15 +0000
committerChris McDonough <chrism@agendaless.com>2009-06-11 03:15:15 +0000
commitdfc2b65c1b6d2f938f68b7868a14d8f9a4faab9e (patch)
treef3241401b7175a401e00286b11e3efe3c21f5093 /docs/narr/hooks.rst
parentf8b0065b6ede54424d7a7b49f9f113e87634b5ab (diff)
downloadpyramid-dfc2b65c1b6d2f938f68b7868a14d8f9a4faab9e.tar.gz
pyramid-dfc2b65c1b6d2f938f68b7868a14d8f9a4faab9e.tar.bz2
pyramid-dfc2b65c1b6d2f938f68b7868a14d8f9a4faab9e.zip
Merge unifyroutesandtraversal branch into trunk
Diffstat (limited to 'docs/narr/hooks.rst')
-rw-r--r--docs/narr/hooks.rst73
1 files changed, 0 insertions, 73 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index 533024352..53d6c8c77 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -7,51 +7,6 @@ ZCML "hooks" can be used to influence the behavior of the
:mod:`repoze.bfg` framework in various ways. This is an advanced
topic; not many people will want or need to do any of these things.
-Changing the request factory
-----------------------------
-
-You may change the class used as the "request factory" from within the
-:mod:`repoze.bfg` ``Router`` class (the ``Router`` class turns the
-WSGI environment into a "request" object which is used ubiquitously
-throughout :mod:`repoze.bfg`). The default "request factory" is the
-class ``webob.Request``. You may change it by placing the following
-ZCML in your ``configure.zcml`` file.
-
-.. code-block:: xml
- :linenos:
-
- <utility provides="repoze.bfg.interfaces.IRequestFactory"
- component="helloworld.factories.request_factory"/>
-
-Replace ``helloworld.factories.request_factory`` with the Python
-dotted name to the request factory you want to use. Here's some
-sample code that implements a minimal request factory:
-
-.. code-block:: python
-
- from webob import Request
- from repoze.bfg.interfaces import IRequest
-
- class MyRequest(Request):
- implements(IRequest)
-
- def request_factory():
- return MyRequest
-
-.. warning:: If you register an ``IRequestFactory`` utility in this
- way, you *must* be sure that the factory returns an object that
- implements *at least* the ``repoze.bfg.interfaces.IRequest``
- interface. Otherwise all application view lookups will fail (they
- will all return a 404 response code). Likewise, if you want to be
- able to use method-related interfaces such as ``IGETRequest``,
- ``IPOSTRequest``, etc. in your view declarations, the callable
- returned by the factory must also do the same introspection of the
- environ that the default request factory does and decorate the
- returned object to implement one of these interfaces based on the
- ``HTTP_METHOD`` present in the environ. Note that the above
- example does not do this, so lookups for method-related interfaces
- will fail.
-
Changing the response factory
-----------------------------
@@ -164,31 +119,3 @@ code that implements a minimal forbidden view:
an alterate forbidden view. For example, it would make sense to
return a response with a ``403 Forbidden`` status code.
-.. _changing_routes_context_factory:
-
-Changing the Default Routes Context Factory
--------------------------------------------
-
-The default Routes "context factory" (the object used to create
-context objects when you use ``<route..>`` statements in your ZCML) is
-``repoze.bfg.urldispatch.DefaultRoutesContext``. You may change the
-class used as the Routes "context factory" by placing the following
-ZCML in your ``configure.zcml`` file.
-
-.. code-block:: xml
- :linenos:
-
- <utility provides="repoze.bfg.interfaces.IRoutesContextFactory"
- component="helloworld.factories.routes_context_factory"/>
-
-Replace ``helloworld.factories.routes_context_factory`` with the
-Python dotted name to the context factory you want to use. Here's
-some sample code that implements a minimal context factory:
-
-.. code-block:: python
- :linenos:
-
- class RoutesContextFactory(object):
- def __init__(self, **kw):
- self.__dict__.update(kw)
-