本文整理汇总了Python中openedx.core.djangoapps.site_configuration.models.SiteConfiguration.has_org方法的典型用法代码示例。如果您正苦于以下问题:Python SiteConfiguration.has_org方法的具体用法?Python SiteConfiguration.has_org怎么用?Python SiteConfiguration.has_org使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openedx.core.djangoapps.site_configuration.models.SiteConfiguration
的用法示例。
在下文中一共展示了SiteConfiguration.has_org方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_value_for_org
# 需要导入模块: from openedx.core.djangoapps.site_configuration.models import SiteConfiguration [as 别名]
# 或者: from openedx.core.djangoapps.site_configuration.models.SiteConfiguration import has_org [as 别名]
def get_value_for_org(org, val_name, default=None):
"""
This returns a configuration value for a site configuration or microsite configuration
which has an org_filter that matches with the argument.
Args:
org (str): Course org filter, this value will be used to filter out the correct site configuration.
name (str): Name of the key for which to return configuration value.
default: default value to return if key is not present in the configuration
Returns:
Configuration value for the given key.
"""
# Here we first look for the asked org inside site configuration, and if org is not present in site configuration
# then we go ahead and look it inside microsite configuration.
if SiteConfiguration.has_org(org):
return SiteConfiguration.get_value_for_org(org, val_name, default)
else:
return microsite.get_value_for_org(org, val_name, default)