summaryrefslogtreecommitdiff
path: root/repoze/bfg/traversal.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-08-08 23:27:38 +0000
committerChris McDonough <chrism@agendaless.com>2008-08-08 23:27:38 +0000
commit5edd5a45526b886a4a3f348262e6888757662bd5 (patch)
tree246b91e4b213b67387ccbff8b79f10701f46b393 /repoze/bfg/traversal.py
parentcc5e490467c105b8cce35c0bca688ed18ec93255 (diff)
downloadpyramid-5edd5a45526b886a4a3f348262e6888757662bd5.tar.gz
pyramid-5edd5a45526b886a4a3f348262e6888757662bd5.tar.bz2
pyramid-5edd5a45526b886a4a3f348262e6888757662bd5.zip
find_context_from_path -> find_model
Diffstat (limited to 'repoze/bfg/traversal.py')
-rw-r--r--repoze/bfg/traversal.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/repoze/bfg/traversal.py b/repoze/bfg/traversal.py
index 3fe11f9f7..e307cae0c 100644
--- a/repoze/bfg/traversal.py
+++ b/repoze/bfg/traversal.py
@@ -74,7 +74,7 @@ def find_root(model):
break
return model
-def find_context_from_path(model, path):
+def find_model(model, path):
""" Given a model object and a string representing a path
reference (a set of names delimited by forward-slashes), return an
context in this application's model graph at the specified path.
@@ -94,11 +94,12 @@ def find_context_from_path(model, path):
raise KeyError('%r has no subelement %s' % (ob, name))
return ob
-def find_interface(context, interface):
- """ Return an object providing ``interface`` anywhere in the
- parent chain of ``context`` or ``None`` if no object providing
- that interface can be found in the parent chain"""
- for location in LocationIterator(context):
+def find_interface(model, interface):
+ """ Return the first object found which provides the 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):
if interface.providedBy(location):
return location