From 5edd5a45526b886a4a3f348262e6888757662bd5 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 8 Aug 2008 23:27:38 +0000 Subject: find_context_from_path -> find_model --- repoze/bfg/traversal.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'repoze/bfg/traversal.py') 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 -- cgit v1.2.3