當前位置: 首頁>>代碼示例>>Python>>正文


Python SampleTemplate.delete方法代碼示例

本文整理匯總了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))
開發者ID:anupriyatripathi,項目名稱:qiita,代碼行數:28,代碼來源:description_handlers.py

示例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)
開發者ID:,項目名稱:,代碼行數:13,代碼來源:

示例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}
開發者ID:yimsea,項目名稱:qiita,代碼行數:26,代碼來源:dispatchable.py


注:本文中的qiita_db.metadata_template.sample_template.SampleTemplate.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。