summaryrefslogtreecommitdiff
path: root/docs/narr/models.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-09-28 02:17:36 +0000
committerChris McDonough <chrism@agendaless.com>2008-09-28 02:17:36 +0000
commitcbdc36976c18a0812f921ee3b7b92ed2dd823ed0 (patch)
treec428c9b0e4357ecf3b5903359594dc6f2bf27a8b /docs/narr/models.rst
parentcd6899ed4d0eba4b114d04058470528c9a167d6e (diff)
downloadpyramid-cbdc36976c18a0812f921ee3b7b92ed2dd823ed0.tar.gz
pyramid-cbdc36976c18a0812f921ee3b7b92ed2dd823ed0.tar.bz2
pyramid-cbdc36976c18a0812f921ee3b7b92ed2dd823ed0.zip
Features
- A ``repoze.bfg.location`` API module was added. Backwards incompatibilities - Applications must now use the ``repoze.bfg.interfaces.ILocation`` interface rather than ``zope.location.interfaces.ILocation`` to represent that a model object is "location-aware". We've removed a dependency on ``zope.location`` for cleanliness purposes: as new versions of zope libraries are released which have improved dependency information, getting rid of our dependence on ``zope.location`` will prevent a newly installed repoze.bfg application from requiring the ``zope.security``, egg, which not truly used at all in a "stock" repoze.bfg setup. These dependencies are still required by the stack at this time; this is purely a futureproofing move. The security and model documentation for previous versions of ``repoze.bfg`` recommended using the ``zope.location.interfaces.ILocation`` interface to represent that a model object is "location-aware". This documentation has been changed to reflect that this interface should now be imported from ``repoze.bfg.interfaces.ILocation`` instead.
Diffstat (limited to 'docs/narr/models.rst')
-rw-r--r--docs/narr/models.rst21
1 files changed, 17 insertions, 4 deletions
diff --git a/docs/narr/models.rst b/docs/narr/models.rst
index 7df265657..e627a682c 100644
--- a/docs/narr/models.rst
+++ b/docs/narr/models.rst
@@ -74,7 +74,7 @@ by via ``__getitem__``.
If you choose not to manage the ``__name__`` and ``__parent__``
attributes of your models "by hand", :mod:`repoze.bfg`` is willing to
help you do this. If your "root" node claims it implements the
-interface ``zope.location.interfaces.ILocation``, you don't need to
+interface ``repoze.bfg.interfaces.ILocation``, you don't need to
manage these attributes by hand. During :term:`traversal`, if the
root node says it implements the ``ILocation`` :term:`interface`,
:mod:`repoze.bfg` will wrap each child in a ``LocationProxy`` which
@@ -84,7 +84,20 @@ recursively.
If you choose to make use of the location-based dynamic assignment of
``__parent__`` and ``__name__``, the root node must have a
``__parent__`` and a ``__name__`` that are both ``None``, and it must
-provide the ``ILocation`` interface. The easiest way to do this is to
-claim that the class representing the root node
-``implements(ILocation)``, as above.
+provide the ``repoze.bfg.interfaces.ILocation`` interface. The
+easiest way to do this is to claim that the class representing the
+root node ``implements(ILocation)``:
+
+.. code-block::
+ :linenos:
+
+ from repoze.bfg.interfaces import ILocation
+ from zope.interface import implements
+
+ class MyRootObject(object):
+ implements(ILocation)
+ __parent__ = None
+ __name__ = ''
+
+