本文整理匯總了Python中qiita_db.metadata_template.sample_template.SampleTemplate.delete方法的典型用法代碼示例。如果您正苦於以下問題:Python SampleTemplate.delete方法的具體用法?Python SampleTemplate.delete怎麽用?Python SampleTemplate.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qiita_db.metadata_template.sample_template.SampleTemplate
的用法示例。
在下文中一共展示了SampleTemplate.delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: delete_sample_template
# 需要導入模塊: from qiita_db.metadata_template.sample_template import SampleTemplate [as 別名]
# 或者: from qiita_db.metadata_template.sample_template.SampleTemplate import delete [as 別名]
def delete_sample_template(self, study, user, callback):
"""Delete sample template
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
"""
sample_template_id = int(self.get_argument('sample_template_id'))
try:
SampleTemplate.delete(sample_template_id)
msg = ("Sample template %d has been deleted from study: "
"<b><i>%s</i></b>" % (sample_template_id, study.title))
msg_level = "success"
except Exception as e:
msg = "Couldn't remove %d sample template: %s" % (
sample_template_id, str(e))
msg_level = "danger"
callback((msg, msg_level, 'study_information_tab', None, None))
示例2: tearDown
# 需要導入模塊: from qiita_db.metadata_template.sample_template import SampleTemplate [as 別名]
# 或者: from qiita_db.metadata_template.sample_template.SampleTemplate import delete [as 別名]
def tearDown(self):
for fp in self._clean_up_files:
if exists(fp):
remove(fp)
study_id = self.new_study.id
for pt in self.new_study.prep_templates():
PrepTemplate.delete(pt.id)
if SampleTemplate.exists(study_id):
SampleTemplate.delete(study_id)
Study.delete(study_id)
示例3: delete_sample_template
# 需要導入模塊: from qiita_db.metadata_template.sample_template import SampleTemplate [as 別名]
# 或者: from qiita_db.metadata_template.sample_template.SampleTemplate import delete [as 別名]
def delete_sample_template(study_id):
"""Delete a sample template
Parameters
----------
study_id : int
Study id whose template is going to be deleted
Returns
-------
dict of {str: str}
A dict of the form {'status': str, 'message': str}
"""
from qiita_db.metadata_template.sample_template import SampleTemplate
msg = ''
status = 'success'
try:
SampleTemplate.delete(study_id)
except Exception as e:
status = 'danger'
msg = str(e)
return {'status': status, 'message': msg}