summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-16 20:59:41 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-16 20:59:41 +0000
commitdef444c2c310c8cb117e0c5181bf74f5beed064c (patch)
tree7415757b8463512dd62923c6c7b400cee0eb8be8 /docs
parent090f6b77dcc8cd738caba4dbb3885ccb6ddb3d41 (diff)
downloadpyramid-def444c2c310c8cb117e0c5181bf74f5beed064c.tar.gz
pyramid-def444c2c310c8cb117e0c5181bf74f5beed064c.tar.bz2
pyramid-def444c2c310c8cb117e0c5181bf74f5beed064c.zip
Speed up common case (use default factory).
Diffstat (limited to 'docs')
-rw-r--r--docs/narr/hooks.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index 585e3e655..21906e466 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -167,3 +167,29 @@ factory:
Forbidden`` status code, rather than use the default unauthorized
application factory, which sends a response with a ``401
Unauthorized`` status code.
+
+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
+
+ class RoutesContextFactory(object):
+ def __init__(self, **kw):
+ self.__dict__.update(kw)
+