Example #1
0
def _cache_project(config, owner=None, project=None):
    if (ProjectConfigManager.is_initialized()
            and ProjectConfigManager.is_locally_initialized()):
        if _is_same_project(owner, project):
            ProjectConfigManager.set_config(config)
            return

    ProjectConfigManager.set_config(
        config, visibility=ProjectConfigManager.VISIBILITY_GLOBAL)
Example #2
0
def cache(config_manager, config, owner=None, project=None):
    if config_manager == ProjectConfigManager:
        _cache_project(config=config, project=project, owner=owner)

    # Set caching only if we have an initialized project
    if not ProjectConfigManager.is_initialized():
        return

    if not _is_same_project(owner, project):
        return

    visibility = (ProjectConfigManager.VISIBILITY_LOCAL
                  if ProjectConfigManager.is_locally_initialized() else
                  ProjectConfigManager.VISIBILITY_GLOBAL)
    config_manager.set_config(config, visibility=visibility)