当前位置: 首页>>代码示例>>Python>>正文


Python Artifact.delete方法代码示例

本文整理汇总了Python中qiita_db.artifact.Artifact.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Artifact.delete方法的具体用法?Python Artifact.delete怎么用?Python Artifact.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qiita_db.artifact.Artifact的用法示例。


在下文中一共展示了Artifact.delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: artifact_delete_req

# 需要导入模块: from qiita_db.artifact import Artifact [as 别名]
# 或者: from qiita_db.artifact.Artifact import delete [as 别名]
def artifact_delete_req(artifact_id, user_id):
    """Deletes the artifact

    Parameters
    ----------
    artifact_id : int
        Artifact being acted on
    user_id : str
        The user requesting the action

    Returns
    -------
    dict
        Status of action, in the form {'status': status, 'message': msg}
        status: status of the action, either success or error
        message: Human readable message for status
    """
    pd = Artifact(int(artifact_id))
    access_error = check_access(pd.study.id, user_id)
    if access_error:
        return access_error
    try:
        Artifact.delete(int(artifact_id))
    except QiitaDBArtifactDeletionError as e:
        return {'status': 'error',
                'message': str(e)}
    return {'status': 'success',
            'message': ''}
开发者ID:yimsea,项目名称:qiita,代码行数:30,代码来源:artifact.py

示例2: delete_raw_data

# 需要导入模块: from qiita_db.artifact import Artifact [as 别名]
# 或者: from qiita_db.artifact.Artifact import delete [as 别名]
    def delete_raw_data(self, study, user, callback):
        """Delete the selected raw data

        Parameters
        ----------
        study : Study
            The current study object
        user : User
            The current user object
        callback : function
            The callback function to call with the results once the processing
            is done
        """
        raw_data_id = int(self.get_argument('raw_data_id'))
        prep_template_id = int(self.get_argument('prep_template_id'))

        try:
            Artifact.delete(raw_data_id)
            msg = ("Raw data %d has been deleted from prep_template %d"
                   % (raw_data_id, prep_template_id))
            msg_level = "success"
        except Exception as e:
            msg = "Couldn't remove raw data %d: %s" % (raw_data_id, str(e))
            msg_level = "danger"

        callback((msg, msg_level, "prep_template_tab", prep_template_id, None))
开发者ID:anupriyatripathi,项目名称:qiita,代码行数:28,代码来源:description_handlers.py

示例3: delete_processed_data

# 需要导入模块: from qiita_db.artifact import Artifact [as 别名]
# 或者: from qiita_db.artifact.Artifact import delete [as 别名]
    def delete_processed_data(self, study, user, callback):
        """Delete the selected processed data

        Parameters
        ----------
        study : Study
            The current study object
        user : User
            The current user object
        callback : function
            The callback function to call with the results once the processing
            is done
        """
        pd_id = int(self.get_argument('processed_data_id'))

        try:
            Artifact.delete(pd_id)
            msg = ("Processed data %d has been deleted" % pd_id)
            msg_level = "success"
            pd_id = None
        except Exception as e:
            msg = ("Couldn't remove processed data %d: %s" %
                   (pd_id, str(e)))
            msg_level = "danger"

        callback((msg, msg_level, 'processed_data_tab', pd_id, None))
开发者ID:anupriyatripathi,项目名称:qiita,代码行数:28,代码来源:description_handlers.py

示例4: delete_artifact

# 需要导入模块: from qiita_db.artifact import Artifact [as 别名]
# 或者: from qiita_db.artifact.Artifact import delete [as 别名]
def delete_artifact(artifact_id):
    """Deletes an artifact from the system

    Parameters
    ----------
    artifact_id : int
        The artifact to delete

    Returns
    -------
    dict of {str: str}
        A dict of the form {'status': str, 'message': str}
    """
    from qiita_db.artifact import Artifact

    status = 'success'
    msg = ''
    try:
        Artifact.delete(artifact_id)
    except Exception as e:
        status = 'danger'
        msg = str(e)

    return {'status': status, 'message': msg}
开发者ID:carlyboyd,项目名称:qiita,代码行数:26,代码来源:dispatchable.py


注:本文中的qiita_db.artifact.Artifact.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。