From def444c2c310c8cb117e0c5181bf74f5beed064c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 16 May 2009 20:59:41 +0000 Subject: Speed up common case (use default factory). --- docs/narr/hooks.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'docs') 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 ```` 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: + + + +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) + -- cgit v1.2.3