Exemplo n.º 1
0
    def create_config(cls, params, prefix=None, name=None):
        """Create a new :class:`.Config` container.

        Invoked during initialisation, it overrides defaults
        with ``params`` and apply the ``prefix`` to non global
        settings.
        """
        if isinstance(cls.cfg, Config):
            cfg = cls.cfg.copy(name=name, prefix=prefix)
        else:
            cfg = cls.cfg.copy()
            if name:
                cfg[name] = name
            if prefix:
                cfg[prefix] = prefix
            cfg = Config(**cfg)
        cfg.update_settings()
        cfg.update(params, True)
        return cfg
Exemplo n.º 2
0
    def create_config(cls, params, prefix=None, name=None):
        '''Create a new :class:`.Config` container.

        Invoked during initialisation, it overrides defaults
        with ``params`` and apply the ``prefix`` to non global
        settings.
        '''
        if isinstance(cls.cfg, Config):
            cfg = cls.cfg.copy(name=name, prefix=prefix)
        else:
            cfg = cls.cfg.copy()
            if name:
                cfg[name] = name
            if prefix:
                cfg[prefix] = prefix
            cfg = Config(**cfg)
        cfg.update_settings()
        cfg.update(params, True)
        return cfg