diff options
| author | Casey Duncan <casey.duncan@gmail.com> | 2010-12-14 23:45:02 -0700 |
|---|---|---|
| committer | Casey Duncan <casey.duncan@gmail.com> | 2010-12-14 23:45:02 -0700 |
| commit | f94e8cfacc182f71b1c8ce8525bc4c0ee901dce2 (patch) | |
| tree | e51b9c64a16bac3f9e8ad77307563ab9237d0f1f /docs | |
| parent | c2a2d3930bbf65c1e56315196d4bdc08906312aa (diff) | |
| download | pyramid-f94e8cfacc182f71b1c8ce8525bc4c0ee901dce2.tar.gz pyramid-f94e8cfacc182f71b1c8ce8525bc4c0ee901dce2.tar.bz2 pyramid-f94e8cfacc182f71b1c8ce8525bc4c0ee901dce2.zip | |
move sidebar about automatically managing __name__ and __parent__ after explaining what they are
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/models.rst | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/docs/narr/models.rst b/docs/narr/models.rst index 086c61d45..905cad1ac 100644 --- a/docs/narr/models.rst +++ b/docs/narr/models.rst @@ -229,29 +229,6 @@ works against model instances. Location-Aware Model Instances ------------------------------ -.. sidebar:: Using :mod:`repoze.bfg.traversalwrapper` - - If you'd rather not manage the ``__name__`` and ``__parent__`` - attributes of your models "by hand", an add on package named - :mod:`repoze.bfg.traversalwrapper` can help. - - In order to use this helper feature, you must first install the - :mod:`repoze.bfg.traversalwrapper` package (available via `SVN - <http://svn.repoze.org/repoze.bfg.traversalwrapper>`_), then - register its ``ModelGraphTraverser`` as the traversal policy, rather - than the default :app:`Pyramid` traverser. The package contains - instructions. - - Once :app:`Pyramid` is configured with this feature, you will no - longer need to manage the ``__parent__`` and ``__name__`` attributes - on graph objects "by hand". Instead, as necessary, during traversal - :app:`Pyramid` will wrap each object (even the root object) in a - ``LocationProxy`` which will dynamically assign a ``__name__`` and a - ``__parent__`` to the traversed object (based on the last traversed - object and the name supplied to ``__getitem__``). The root object - will have a ``__name__`` attribute of ``None`` and a ``__parent__`` - attribute of ``None``. - Applications which use :term:`traversal` to locate the :term:`context` of a view must ensure that the model instances that make up the model graph are "location aware". @@ -298,6 +275,29 @@ and so on. to every path and URL generated (as opposed to a single leading slash or empty tuple element). +.. sidebar:: Using :mod:`repoze.bfg.traversalwrapper` + + If you'd rather not manage the ``__name__`` and ``__parent__`` + attributes of your models "by hand", an add-on package named + :mod:`repoze.bfg.traversalwrapper` can help. + + In order to use this helper feature, you must first install the + :mod:`repoze.bfg.traversalwrapper` package (available via `SVN + <http://svn.repoze.org/repoze.bfg.traversalwrapper>`_), then + register its ``ModelGraphTraverser`` as the traversal policy, rather + than the default :app:`Pyramid` traverser. The package contains + instructions for doing so. + + Once :app:`Pyramid` is configured with this feature, you will no + longer need to manage the ``__parent__`` and ``__name__`` attributes + on graph objects "by hand". Instead, as necessary, during traversal + :app:`Pyramid` will wrap each object (even the root object) in a + ``LocationProxy`` which will dynamically assign a ``__name__`` and a + ``__parent__`` to the traversed object (based on the last traversed + object and the name supplied to ``__getitem__``). The root object + will have a ``__name__`` attribute of ``None`` and a ``__parent__`` + attribute of ``None``. + .. index:: single: model API functions single: url generation (traversal) |
