本文整理匯總了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)