示例#1
0
 def children(self, child_field):
     """Get a list of all direct project tree children inside the provided child_field
     Arguments:
         child_field[str]: A field name
     Returns:
         A list of PdmObjects inside the child_field
     """
     request = PdmObject_pb2.PdmChildObjectRequest(object=self._pb2_object,
                                                   child_field=child_field)
     object_list = self._pdm_object_stub.GetChildPdmObjects(request).objects
     child_list = []
     for pdm_object in object_list:
         child_list.append(PdmObject(pdm_object, self._channel))
     return child_list
示例#2
0
def children(self, child_field, class_definition=PdmObject):
    """Get a list of all direct project tree children inside the provided child_field
    Arguments:
        child_field[str]: A field name
    Returns:
        A list of PdmObjects inside the child_field
    """
    request = PdmObject_pb2.PdmChildObjectRequest(object=self._pb2_object,
                                                  child_field=child_field)
    try:
        object_list = self._pdm_object_stub.GetChildPdmObjects(request).objects
        return self.__from_pb2_to_pdm_objects(object_list, class_definition)
    except grpc.RpcError as e:
        if e.code() == grpc.StatusCode.NOT_FOUND:
            return []
        raise e