Traversal Adapters

Adapters for the traversing mechanism.

class zope.traversing.adapters.DefaultTraversable(subject)[source]

Bases: object

Traverses objects via attribute and item lookup.

Implements ITraversable.

class zope.traversing.adapters.Traverser(wrapper)[source]

Bases: object

Provide traverse features.

Implements ITraverser.

zope.traversing.adapters.traversePathElement(obj, name, further_path, default=<object object>, traversable=None, request=None)[source]

Traverse a single step name relative to the given object.

This is used to implement zope.traversing.interfaces.ITraversalAPI.traverseName().

Parameters:
  • name (str) – 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.
  • further_path (list) – a list of names still to be traversed. This method is allowed to change the contents of further_path.
  • traversable (ITraversable) – You can explicitly pass in an ITraversable as the traversable argument. If you do not, the given object will be adapted to ITraversable.
  • 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.