diff options
Diffstat (limited to 'src/zope/traversing/adapters.py')
-rw-r--r-- | src/zope/traversing/adapters.py | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/zope/traversing/adapters.py b/src/zope/traversing/adapters.py index 45d6e92..69ad836 100644 --- a/src/zope/traversing/adapters.py +++ b/src/zope/traversing/adapters.py @@ -11,7 +11,8 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -"""Adapters for the traversing mechanism +""" +Adapters for the traversing mechanism. """ import six @@ -30,7 +31,11 @@ _marker = object() # opaque marker that doesn't get security proxied @zope.interface.implementer(ITraversable) class DefaultTraversable(object): - """Traverses objects via attribute and item lookup""" + """ + Traverses objects via attribute and item lookup. + + Implements `~zope.traversing.interfaces.ITraversable`. + """ def __init__(self, subject): self._subject = subject @@ -58,7 +63,11 @@ class DefaultTraversable(object): @zope.interface.implementer(ITraverser) class Traverser(object): - """Provide traverse features""" + """ + Provide traverse features. + + Implements `~zope.traversing.interfaces.ITraverser`. + """ # This adapter can be used for any object. @@ -99,24 +108,29 @@ class Traverser(object): def traversePathElement(obj, name, further_path, default=_marker, traversable=None, request=None): - """Traverse a single step 'name' relative to the given object. - - 'name' must be a string. '.' and '..' are treated specially, as well as - names starting with '@' or '+'. Otherwise 'name' will be treated as a - single path segment. + """ + Traverse a single step *name* relative to the given object. - 'further_path' is a list of names still to be traversed. This method - is allowed to change the contents of 'further_path'. + This is used to implement + :meth:`zope.traversing.interfaces.ITraversalAPI.traverseName`. - You can explicitly pass in an ITraversable as the 'traversable' - argument. If you do not, the given object will be adapted to ITraversable. + :param str name: must be a string. '.' and '..' are treated + specially, as well as names starting with '@' or '+'. + Otherwise *name* will be treated as a single path segment. + :param list further_path: a list of names still to be traversed. + This method is allowed to change the contents of + *further_path*. - 'request' is passed in when traversing from presentation code. This - allows paths like @@foo to work. + :keyword ITraversable traversable: You can explicitly pass in + an `~zope.traversing.interfaces.ITraversable` as the + *traversable* argument. If you do not, the given object will + be adapted to ``ITraversable``. - Raises LocationError if path cannot be found and 'default' was - not provided. + :keyword request: assed in when traversing from presentation + code. This allows paths like ``@@foo`` to work. + :raises zope.location.interfaces.LocationError: if *path* cannot + be found and '*default* was not provided. """ __traceback_info__ = (obj, name) |