def traverse(object, path, default=_marker, request=None): """ Traverse *path* relative to the given object. See `ITraversalAPI` for details. """ traverser = ITraverser(object) if default is _marker: return traverser.traverse(path, request=request) return traverser.traverse(path, default=default, request=request)
def traverse(object, path, default=_marker, request=None): """Traverse 'path' relative to the given object. 'path' is a string with path segments separated by '/'. 'request' is passed in when traversing from presentation code. This allows paths like @@foo to work. Raises LocationError if path cannot be found Note: calling traverse with a path argument taken from an untrusted source, such as an HTTP request form variable, is a bad idea. It could allow a maliciously constructed request to call code unexpectedly. Consider using traverseName instead. """ traverser = ITraverser(object) if default is _marker: return traverser.traverse(path, request=request) return traverser.traverse(path, default=default, request=request)
def traverse(object, path, default=_marker, request=None): """Traverse 'path' relative to the given object. 'path' is a string with path segments separated by '/'. 'request' is passed in when traversing from presentation code. This allows paths like @@foo to work. Raises LocationError if path cannot be found Note: calling traverse with a path argument taken from an untrusted source, such as an HTTP request form variable, is a bad idea. It could allow a maliciously constructed request to call code unexpectedly. Consider using traverseName instead. """ traverser = ITraverser(object) if default is _marker: return traverser.traverse(path, request=request) else: return traverser.traverse(path, default=default, request=request)
def testImplementsITraverser(self): self.assertTrue(ITraverser.providedBy(self.tr))
def testImplementsITraverser(self): self.failUnless(ITraverser.providedBy(self.tr))