summaryrefslogtreecommitdiff
path: root/repoze/bfg/traversal.py
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 /repoze/bfg/traversal.py
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 'repoze/bfg/traversal.py')
-rw-r--r--repoze/bfg/traversal.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py
index 9783955de..f5d45cd55 100644
--- a/repoze/bfg/traversal.py
+++ b/repoze/bfg/traversal.py
@@ -3,10 +3,10 @@ import urlparse
from zope.interface import classProvides
from zope.interface import implements
-from zope.location.location import located
-from zope.location.location import LocationIterator
-from zope.location.interfaces import ILocation
+from repoze.bfg.location import locate
+from repoze.bfg.location import lineage
+from repoze.bfg.interfaces import ILocation
from repoze.bfg.interfaces import ITraverser
from repoze.bfg.interfaces import ITraverserFactory
@@ -60,7 +60,7 @@ class ModelGraphTraverser(object):
name = segment
break
if self.locatable:
- next = located(next, ob, segment)
+ next = locate(next, ob, segment)
ob = next
return ob, name, path
@@ -68,7 +68,7 @@ class ModelGraphTraverser(object):
def find_root(model):
""" Find the root node in the graph to which ``model``
belongs. Note that ``model`` should be :term:`location`-aware."""
- for location in LocationIterator(model):
+ for location in lineage(model):
if location.__parent__ is None:
model = location
break
@@ -99,7 +99,7 @@ def find_interface(model, interface):
``interface`` in the parent chain of ``model`` or ``None`` if no
object providing ``interface`` can be found in the parent chain.
The ``model`` passed in should be :term:`location`-aware."""
- for location in LocationIterator(model):
+ for location in lineage(model):
if interface.providedBy(location):
return location
@@ -112,7 +112,7 @@ def model_url(model, request, *elements):
URL-quoted. The ``model`` passed in must be
:term:`location`-aware."""
rpath = []
- for location in LocationIterator(model):
+ for location in lineage(model):
if location.__name__:
rpath.append(urllib.quote(location.__name__))
path = list(reversed(rpath))
@@ -127,7 +127,7 @@ def model_path(model, *elements):
will be joined by slashes and appended to the generated path. The
``model`` passed in must be :term:`location`-aware."""
rpath = []
- for location in LocationIterator(model):
+ for location in lineage(model):
if location.__name__:
rpath.append(location.__name__)
path = list(reversed(rpath))