Пример #1
0
def get_tst_config(overconf={}):
    global _testconfig
    if _testconfig is None:
        conf = {
            'scheme': 'http',
            'protocol': "HTTP/1.1",
            'port': 54583,
            'host': '127.0.0.1',
            'validate': False,
            'conquer': False,
            'server': 'wsgi',
        }
        try:
            import testconfig
            _conf = testconfig.config.get('supervisor', None)
            if _conf is not None:
                for k, v in _conf.items():
                    if isinstance(v, text_or_bytes):
                        _conf[k] = unrepr(v)
                conf.update(_conf)
        except ImportError:
            pass
        _testconfig = conf
    conf = _testconfig.copy()
    conf.update(overconf)

    return conf
Пример #2
0
def get_tst_config(overconf={}):
    global _testconfig
    if _testconfig is None:
        conf = {
            'scheme': 'http',
            'protocol': "HTTP/1.1",
            'port': 54583,
            'host': '127.0.0.1',
            'validate': False,
            'server': 'wsgi',
        }
        try:
            import testconfig
            _conf = testconfig.config.get('supervisor', None)
            if _conf is not None:
                for k, v in _conf.items():
                    if isinstance(v, text_or_bytes):
                        _conf[k] = unrepr(v)
                conf.update(_conf)
        except ImportError:
            pass
        _testconfig = conf
    conf = _testconfig.copy()
    conf.update(overconf)

    return conf
Пример #3
0
    def as_dict(self, raw=False, vars=None):
        """Convert an INI file to a dictionary"""
        # Load INI file into a dict
        result = {}
        for section in self.sections():
            if section not in result:
                result[section] = {}
            for option in self.options(section):
                # Do not parse logging config to Python values.
                if section == 'global' or section.startswith('/'):
                    value = self.get(section, option, raw, vars)
                    try:
                        value = unrepr(value)
                    except Exception, x:
                        msg = ("Config error in section: %r, option: %r, "
                               "value: %r. Config values must be valid Python." %
                               (section, option, value))
                        raise ValueError(msg, x.__class__.__name__, x.args)
                else:
                    value = self.get(section, option, raw=True)

                result[section][option] = value
Пример #4
0
    def as_dict(self, raw=False, vars=None):
        """Convert an INI file to a dictionary"""
        # Load INI file into a dict
        result = {}
        for section in self.sections():
            if section not in result:
                result[section] = {}
            for option in self.options(section):
                # Do not parse logging config to Python values.
                if section == 'global' or section.startswith('/'):
                    value = self.get(section, option, raw, vars)
                    try:
                        value = unrepr(value)
                    except Exception, x:
                        msg = (
                            "Config error in section: %r, option: %r, "
                            "value: %r. Config values must be valid Python." %
                            (section, option, value))
                        raise ValueError(msg, x.__class__.__name__, x.args)
                else:
                    value = self.get(section, option, raw=True)

                result[section][option] = value