def get_from_path(items, path):
 if (path is None):
  raise exception.Error('Invalid mini_xpath')
 (first_token, sep, remainder) = path.partition('/')
 if (first_token == ''):
  raise exception.Error('Invalid mini_xpath')
 results = []
 if (items is None):
  return results
 if (not isinstance(items, list)):
  items = [items]
 for item in items:
  if (item is None):
   continue
  get_method = getattr(item, 'get', None)
  if (get_method is None):
   continue
  child = get_method(first_token)
  if (child is None):
   continue
  if isinstance(child, list):
   for x in child:
    results.append(x)
  else:
   results.append(child)
 if (not sep):
  return results
 else:
  return get_from_path(results, remainder)

def get_from_path ( items , path ) : if ( path is None ) : raise exception . Error ( 'Invalid mini_xpath' ) ( first_token , sep , remainder ) = path . partition ( '/' ) if ( first_token == '' ) : raise exception . Error ( 'Invalid mini_xpath' ) results = [ ] if ( items is None ) : return results if ( not isinstance ( items , list ) ) : items = [ items ] for item in items : if ( item is None ) : continue get_method = getattr ( item , 'get' , None ) if ( get_method is None ) : continue child = get_method ( first_token ) if ( child is None ) : continue if isinstance ( child , list ) : for x in child : results . append ( x ) else : results . append ( child ) if ( not sep ) : return results else : return get_from_path ( results , remainder )
returns a list of items matching the specified path .