From 68a01e26af1a0a1ab448d4dad517001186d134b2 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 7 Sep 2011 06:09:43 -0400 Subject: more refs to root factory docs --- docs/narr/urldispatch.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'docs') diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index 52f6115eb..ad9cc6033 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -1030,6 +1030,19 @@ In this way, each route can use a different factory, making it possible to supply a different :term:`context` resource object to the view related to each particular route. +A factory must be a callable which accepts a request and returns an arbitrary +Python object. For example, the below class can be used as a factory: + +.. code-block:: python + :linenos: + + class Mine(object): + def __init__(self, request): + pass + +A route factory is actually conceptually identical to the :term:`root +factory` described at :ref:`the_resource_tree`. + Supplying a different resource factory for each route is useful when you're trying to use a :app:`Pyramid` :term:`authorization policy` to provide declarative, "context sensitive" security checks; each resource can maintain -- cgit v1.2.3