Check koji.conf.d files for this profile's setting.

        :param setting: ``str`` like "server" (for kojihub) or "weburl"
        :returns: ``str``, value for this setting
975814
def lookup(self, profile, setting):
        
        for path in profiles():
            cfg = SafeConfigParser()
            cfg.read(path)
            if profile not in cfg.sections():
                continue
            if not cfg.has_option(profile, setting):
                continue
            return cfg.get(profile, setting)
913488
def __load_settings_from_file(self):
        
        filename = self.get_base_path() + 'settings.json'

        if not exists(filename):
            raise OneLogin_Saml2_Error(
                'Settings file not found: %s',
                OneLogin_Saml2_Error.SETTINGS_FILE_NOT_FOUND,
                filename
            )

        # In the php toolkit instead of being a json file it is a php file and
        # it is directly included
        with open(filename, 'r') as json_data:
            settings = json.loads(json_data.read())

        advanced_filename = self.get_base_path() + 'advanced_settings.json'
        if exists(advanced_filename):
            with open(advanced_filename, 'r') as json_data:
                settings.update(json.loads(json_data.read()))  # Merge settings

        return self.__load_settings_from_dict(settings)
20184
def check_web_config(config_fname):
    '''
        
    '''
    print("Looking for config file at {0} ...".format(config_fname))
    config = RawConfigParser()
    try:
        config.readfp(open(config_fname))
        return config
    except IOError:
        print("ERROR: Seems like the config file does not exist. Please call 'opensubmit-web configcreate' first, or specify a location with the '-c' option.")
        return None
1092329
def _check_file(self):
        
        if not os.path.exists(self.file_path):
            return False
        self._migrate()
        config = configparser.RawConfigParser()
        config.read(self.file_path)
        try:
            config.get(
                escape_for_ini('keyring-setting'),
                escape_for_ini('password reference'),
            )
        except (configparser.NoSectionError, configparser.NoOptionError):
            return False
        try:
            self._check_scheme(config)
        except AttributeError:
            # accept a missing scheme
            return True
        return self._check_version(config)
867543
def restoreSettings(self, settings):
        
        key     = self.objectName()
        value   = unwrapVariant(settings.value('%s/profile' % key))
        
        if not value:
            self.reset(force = True)
            return False
            
        profile = value
        
        # restore the view type settings
        for viewType in self.viewTypes():
            viewType.restoreGlobalSettings(settings)
        
        # restore the profile
        self.restoreProfile(XViewProfile.fromString(profile))
        
        if not self.views():
            self.reset(force = True)
        
        return True
330049
def get_plugin_settings(plugin, directory=None):
    """"""
    repo = require_repo(directory)
    plugins = get_value(repo, 'plugins')
    return plugins.get(plugin) if isinstance(plugins, dict) else None
184934
def _user_settings(self):
        
        user_settings = getattr(settings, self._name, {})
        if not user_settings and self._required:
            raise ImproperlyConfigured("Settings file is missing dict options with name {}".format(self._name))
        keys = frozenset(user_settings.keys())

        required = self._required - keys
        if required:
            raise ImproperlyConfigured("Following options for {} are missing from settings file: {}".format(self._name, ', '.join(sorted(required))))

        removed = keys & self._removed
        if removed:
            raise ImproperlyConfigured("Following options for {} have been removed: {}".format(self._name, ', '.join(sorted(removed))))

        return user_settings
754372
def inspect(config_file, profile):
    """"""

    try:
        section = load_profile_from_files(
            [config_file] if config_file else None, profile)

        click.echo("Configuration file: {}".format(config_file if config_file else "auto-detected"))
        click.echo("Profile: {}".format(profile if profile else "auto-detected"))
        click.echo("---")
        for key, val in section.items():
            click.echo("{} = {}".format(key, val))

    except (ValueError, ConfigFileReadError, ConfigFileParseError) as e:
        click.echo(e)
709956
def findSettingsModule():
    ""
    try:
        with open('manage.py', 'r') as manage:
            manage_contents = manage.read()

            search = re.search(
                r"([\"\'](?P<module>[a-z\.]+)[\"\'])", manage_contents
            )
            if search:  # django version < 1.7
                settings_mod = search.group("module")

            else:
                # in 1.7, manage.py settings declaration looks like:
                # os.environ.setdefault(
                #     "DJANGO_SETTINGS_MODULE", "example_app.settings"
                # )
                search = re.search(
                    "\".*?\"(,\\s)??\"(?P<module>.*?)\"\\)$",
                    manage_contents, re.I | re.S | re.M
                )
                settings_mod = search.group("module")

        os.environ.setdefault('DJANGO_SETTINGS_MODULE', settings_mod)
    except IOError as e:
        msg = (
                str(e) + '\nPlease ensure that you are in the same directory '
                         'as django\'s "manage.py" file.'
        )
        raise IOError(chalk.red(msg), None, sys.exc_info()[2])
    except AttributeError:
        settings_mod = ''
    return settings_mod
535879
def get_current(self):
        
        from django.conf import settings
        try:
            site_id = settings.SITE_ID
        except AttributeError:
            raise ImproperlyConfigured(
                'You\'re using the Django "sites framework" without having '
                'set the SITE_ID setting. Create a site in your database and '
                'set the SITE_ID setting to fix this error.')

        try:
            current_usersettings = USERSETTINGS_CACHE[site_id]
        except KeyError:
            current_usersettings = self.get(site_id=site_id)
            USERSETTINGS_CACHE[site_id] = current_usersettings
        return current_usersettings
478300
def _check_version(self, config):
        
        try:
            self.file_version = config.get(
                escape_for_ini('keyring-setting'),
                escape_for_ini('version'),
            )
        except (configparser.NoSectionError, configparser.NoOptionError):
            return False
        return True
971837
def get_go_server(settings=None):
    
    if not settings:
        settings = get_settings()

    return gocd.Server(
        settings.get('server'),
        user=settings.get('user'),
        password=settings.get('password'),
    )
774014
def _get_setting(self, setting_dotted_name, default=None):
        
        name_list = setting_dotted_name.split('.')
        setting_obj = getattr(django.conf.settings, name_list[0], default)
        # if len(name_list) == 1:
        #   return setting_obj

        return functools.reduce(
            lambda o, a: o.get(a, default), [setting_obj] + name_list[1:]
        )
47879
def setting(self, setting_name, default=None):  # type: (str) -> Any
        
        keys = setting_name.split(".")

        config = self._content
        for key in keys:
            if key not in config:
                return default

            config = config[key]

        return config
809881
def get_settings(self, link):
        
        return reverse(
            'servicesettings-detail', kwargs={'uuid': link.service.settings.uuid}, request=self.context['request'])
228724
def _check_global_settings():
    
    global settings
    if settings is not None:
        #We must have already loaded this and everything was okay!
        return True
    
    from os import getenv
    result = False
    
    if getenv("PYCI_XML") is None:
        err("The environment variable PYCI_XML for the global configuration "
            "has not been set.")
    else:
        from os import path
        fullpath = path.abspath(path.expanduser(getenv("PYCI_XML")))
        if not path.isfile(fullpath):
            err("The file {} for global configuration does not exist.".format(fullpath))
        else:
            from pyci.config import GlobalSettings
            settings = GlobalSettings()
            result = True

    return result
1119923
def getConf(cls, settings, options):
        ""
        ports = ['http_port', 'https_port', 'cache_port']
        for port_name in ports:
            port = getattr(settings, port_name.upper(), None)
            # only use the settings ports if the defaults were left unchanged
            default = getattr(defaults, port_name.upper())
            if port and options.get(port_name) == default:
                options[port_name] = port

        _opts = [
            ('key', 'hx_private_key'),
            ('cert', 'hx_certficate'),
            ('wsgi', 'wsgi_application')
        ]
        for opt_name, settings_name in _opts:
            opt = getattr(settings, settings_name.upper(), None)
            if opt:
                options[opt_name] = opt

        if not options['settings']:
            options['settings'] = environ['DJANGO_SETTINGS_MODULE']
        return options