mirror of
https://github.com/yweber/lodel2.git
synced 2025-11-13 17:39:16 +01:00
Modifying settings class to allow usage of custom confspecs
a bit dirty & quick
This commit is contained in:
parent
b44113b74a
commit
0ffe60ff2b
1 changed files with 9 additions and 3 deletions
|
|
@ -80,13 +80,15 @@ class Settings(object, metaclass=MetaSettings):
|
||||||
|
|
||||||
## @brief Instanciate the Settings singleton
|
## @brief Instanciate the Settings singleton
|
||||||
# @param conf_dir str : The configuration directory
|
# @param conf_dir str : The configuration directory
|
||||||
def __init__(self, conf_dir):
|
#@param custom_confspec None | dict : if given overwrite default lodel2
|
||||||
|
#confspecs
|
||||||
|
def __init__(self, conf_dir, custom_confspecs = None):
|
||||||
self.singleton_assert() # check that it is the only instance
|
self.singleton_assert() # check that it is the only instance
|
||||||
Settings.instance = self
|
Settings.instance = self
|
||||||
## @brief Configuration specification
|
## @brief Configuration specification
|
||||||
#
|
#
|
||||||
# Initialized by Settings.__bootstrap() method
|
# Initialized by Settings.__bootstrap() method
|
||||||
self.__conf_specs = None
|
self.__conf_specs = custom_confspecs
|
||||||
## @brief Stores the configurations in namedtuple tree
|
## @brief Stores the configurations in namedtuple tree
|
||||||
self.__confs = None
|
self.__confs = None
|
||||||
self.__conf_dir = conf_dir
|
self.__conf_dir = conf_dir
|
||||||
|
|
@ -137,7 +139,11 @@ class Settings(object, metaclass=MetaSettings):
|
||||||
LodelContext.expose_modules(globals(), {
|
LodelContext.expose_modules(globals(), {
|
||||||
'lodel.plugin.plugins': ['Plugin', 'PluginError']})
|
'lodel.plugin.plugins': ['Plugin', 'PluginError']})
|
||||||
logger.debug("Settings bootstraping")
|
logger.debug("Settings bootstraping")
|
||||||
lodel2_specs = LODEL2_CONF_SPECS
|
if self.__conf_specs is None:
|
||||||
|
lodel2_specs = LODEL2_CONF_SPECS
|
||||||
|
else:
|
||||||
|
lodel2_specs = self.__conf_specs
|
||||||
|
self.__conf_specs = None
|
||||||
loader = SettingsLoader(self.__conf_dir)
|
loader = SettingsLoader(self.__conf_dir)
|
||||||
plugin_list = []
|
plugin_list = []
|
||||||
for ptype_name,ptype in Plugin.plugin_types().items():
|
for ptype_name,ptype in Plugin.plugin_types().items():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue