Esempio n. 1
0
    def save(cls,
             stored_data,
             workspace_id,
             objid=None,
             name=None,
             typestr=None):
        """
        Saves data into the service and returns a StoredObject representing that data

        :param stored_data: the data representing the object to be saved
        :param stored_type: the string type of the object to be saved
        :param workspace_id: the destination workspace
        :param objid: (optional) the destination object_id. See service.save_object for troubleshooting
        :param name: (optional) the destination name for the object
        :return: a StoredObject for the data provided
        """
        if cls.storedType is None and typestr is None:
            raise StoredTypeError(
                str(cls) +
                " can't be saved. A more specific type must be used.")
        argtype = cls.storedType
        if typestr is not None:
            argtype = typestr
        info = service.save_object(stored_data,
                                   argtype,
                                   workspace_id,
                                   objid=objid,
                                   name=name)
        return cls(info[0], info[1])
Esempio n. 2
0
    def save(cls, stored_data, workspace_id, objid=None, name=None, typestr=None):
        """
        Saves data into the service and returns a StoredObject representing that data

        :param stored_data: the data representing the object to be saved
        :param stored_type: the string type of the object to be saved
        :param workspace_id: the destination workspace
        :param objid: (optional) the destination object_id. See service.save_object for troubleshooting
        :param name: (optional) the destination name for the object
        :return: a StoredObject for the data provided
        """
        if cls.storedType is None and typestr is None:
            raise StoredTypeError(str(cls) + " can't be saved. A more specific type must be used.")
        argtype = cls.storedType
        if typestr is not None:
            argtype = typestr
        info = service.save_object(stored_data, argtype, workspace_id, objid=objid, name=name)
        return cls(info[0], info[1])
Esempio n. 3
0
def save_object(data, type, wsid, objid=None, name=None):
    return service.save_object(data,type, wsid, objid=objid, name=name)