本文整理汇总了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': ''}
示例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))
示例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))
示例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}