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


Python SampleTemplate.check_restrictions方法代码示例

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


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

示例1: display_template

# 需要导入模块: from qiita_db.metadata_template.sample_template import SampleTemplate [as 别名]
# 或者: from qiita_db.metadata_template.sample_template.SampleTemplate import check_restrictions [as 别名]
    def display_template(self, study, user, msg, msg_level, full_access,
                         top_tab=None, sub_tab=None, prep_tab=None):
        """Simple function to avoid duplication of code"""
        study_status = study.status
        user_level = user.level
        sample_template_exists = SampleTemplate.exists(study.id)

        if sample_template_exists:
            st = SampleTemplate(study.id)
            missing_cols = st.check_restrictions(
                [SAMPLE_TEMPLATE_COLUMNS['qiita_main']])
            allow_approval = len(missing_cols) == 0
            approval_deny_msg = (
                "Processed data approval request is disabled due to missing "
                "columns in the sample template: %s" % ', '.join(missing_cols))
        else:
            allow_approval = False
            approval_deny_msg = ""

        # The general information of the study can be changed if the study is
        # not public or if the user is an admin, in which case they can always
        # modify the information of the study
        show_edit_btn = study_status != 'public' or user_level == 'admin'

        # Make the error message suitable for html
        msg = msg.replace('\n', "<br/>")

        self.render('study_description.html',
                    message=msg,
                    level=msg_level,
                    study=study,
                    study_title=study.title,
                    study_alias=study.info['study_alias'],
                    show_edit_btn=show_edit_btn,
                    show_data_tabs=sample_template_exists,
                    full_access=full_access,
                    allow_approval=allow_approval,
                    approval_deny_msg=approval_deny_msg,
                    top_tab=top_tab,
                    sub_tab=sub_tab,
                    prep_tab=prep_tab)
开发者ID:anupriyatripathi,项目名称:qiita,代码行数:43,代码来源:description_handlers.py


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