def traverse(resource, path):
 if is_nonstr_iter(path):
  if path:
   path = _join_path_tuple(tuple(path))
  else:
   path = ''
 path = ascii_native_(path)
 if (path and (path[0] == '/')):
  resource = find_root(resource)
 reg = get_current_registry()
 request_factory = reg.queryUtility(IRequestFactory)
 if (request_factory is None):
  from pyramid.request import Request
  request_factory = Request
 request = request_factory.blank(path)
 request.registry = reg
 traverser = reg.queryAdapter(resource, ITraverser)
 if (traverser is None):
  traverser = ResourceTreeTraverser(resource)
 return traverser(request)

def traverse ( resource , path ) : if is_nonstr_iter ( path ) : if path : path = _join_path_tuple ( tuple ( path ) ) else : path = '' path = ascii_native_ ( path ) if ( path and ( path [ 0 ] == '/' ) ) : resource = find_root ( resource ) reg = get_current_registry ( ) request_factory = reg . queryUtility ( IRequestFactory ) if ( request_factory is None ) : from pyramid . request import Request request_factory = Request request = request_factory . blank ( path ) request . registry = reg traverser = reg . queryAdapter ( resource , ITraverser ) if ( traverser is None ) : traverser = ResourceTreeTraverser ( resource ) return traverser ( request )
traverse and visit the given expression structure using the default iterator .