diff options
| author | Chris McDonough <chrism@plope.com> | 2011-09-07 06:09:43 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-09-07 06:09:43 -0400 |
| commit | 68a01e26af1a0a1ab448d4dad517001186d134b2 (patch) | |
| tree | 021484a5a8836cbdb4a14ef38b5933fc0508888e /docs | |
| parent | 0507ac4cdb9515b447affdcf23eae20614d71fca (diff) | |
| download | pyramid-68a01e26af1a0a1ab448d4dad517001186d134b2.tar.gz pyramid-68a01e26af1a0a1ab448d4dad517001186d134b2.tar.bz2 pyramid-68a01e26af1a0a1ab448d4dad517001186d134b2.zip | |
more refs to root factory docs
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/urldispatch.rst | 13 |
1 files changed, 13 insertions, 0 deletions
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 |
