diff options
| author | Chris McDonough <chrism@plope.com> | 2013-10-02 18:47:07 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2013-10-02 18:47:07 -0400 |
| commit | af2893269f563b856da06d4f90ae8b324ad2cadb (patch) | |
| tree | 0523b72baa5151eae930ce40edf20f53d453d1be /docs | |
| parent | 79d9d6862ff906aa0bf26968e0ba763c54775b5c (diff) | |
| parent | 44436e1240f497e598de7b316ffaf7b6b8665452 (diff) | |
| download | pyramid-af2893269f563b856da06d4f90ae8b324ad2cadb.tar.gz pyramid-af2893269f563b856da06d4f90ae8b324ad2cadb.tar.bz2 pyramid-af2893269f563b856da06d4f90ae8b324ad2cadb.zip | |
Merge branch 'docs/remove_redundant' of github.com:bertjwregeer/pyramid into bertjwregeer-docs/remove_redundant
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/traversal.rst | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/docs/narr/traversal.rst b/docs/narr/traversal.rst index a60c5ba56..fb4adff61 100644 --- a/docs/narr/traversal.rst +++ b/docs/narr/traversal.rst @@ -128,6 +128,12 @@ Here's an example of a simple root factory class: def __init__(self, request): pass +..note:: + For the purpose of understanding traversal, and the contents within + this document, the above Root is an analogue to the default root + factory present in Pyramid. The default root factory is very simple and + not very useful unless using :term:`URL dispatch`. + Here's an example of using this root factory within startup configuration, by passing it to an instance of a :term:`Configurator` named ``config``: @@ -154,28 +160,6 @@ Usually a root factory for a traversal-based application will be more complicated than the above ``Root`` class; in particular it may be associated with a database connection or another persistence mechanism. -.. sidebar:: Emulating the Default Root Factory - - For purposes of understanding the default root factory better, we'll note - that you can emulate the default root factory by using this code as an - explicit root factory in your application setup: - - .. code-block:: python - :linenos: - - class Root(object): - def __init__(self, request): - pass - - config = Configurator(root_factory=Root) - - The default root factory is just a really stupid object that has no - behavior or state. Using :term:`traversal` against an application that - uses the resource tree supplied by the default root resource is not very - interesting, because the default root resource has no children. Its - availability is more useful when you're developing an application using - :term:`URL dispatch`. - .. note:: If the items contained within the resource tree are "persistent" (they |
