def resources_from_path(instance, path):
 if ('.' in path):
  path = path.split('.')
 else:
  path = [path]
 seen = set()
 nextlevel = set([instance])
 first_time = True
 while nextlevel:
  thislevel = nextlevel
  nextlevel = set()
  if path:
   relation = path.pop(0)
  else:
   relation = None
  for resource in thislevel:
   if (resource in seen):
    continue
   if first_time:
    first_time = False
   else:
    (yield resource)
   seen.add(resource)
   if (relation is not None):
    if is_like_list(resource, relation):
     update = nextlevel.update
    else:
     update = nextlevel.add
    update(getattr(resource, relation))

def resources_from_path ( instance , path ) : if ( '.' in path ) : path = path . split ( '.' ) else : path = [ path ] seen = set ( ) nextlevel = set ( [ instance ] ) first_time = True while nextlevel : thislevel = nextlevel nextlevel = set ( ) if path : relation = path . pop ( 0 ) else : relation = None for resource in thislevel : if ( resource in seen ) : continue if first_time : first_time = False else : ( yield resource ) seen . add ( resource ) if ( relation is not None ) : if is_like_list ( resource , relation ) : update = nextlevel . update else : update = nextlevel . add update ( getattr ( resource , relation ) )
returns an iterable of all resources along the given relationship path for the specified instance of the model .