metaconfig support
This commit is contained in:
@ -850,8 +850,12 @@ class TiramisuContextOption(TiramisuContext):
|
||||
withoption=None,
|
||||
fullpath=False):
|
||||
"""return dict with path as key and value"""
|
||||
config_bag = self.config_bag.copy()
|
||||
config_bag._setting_properties = self.config_bag.setting_properties - {'warnings'}
|
||||
#config_bag = self.config_bag
|
||||
if self.config_bag.setting_properties is None:
|
||||
config_bag = self.config_bag
|
||||
else:
|
||||
config_bag = self.config_bag.copy()
|
||||
config_bag._setting_properties = self.config_bag.setting_properties - {'warnings'}
|
||||
return config_bag.context.make_dict(config_bag,
|
||||
flatten=flatten,
|
||||
fullpath=fullpath,
|
||||
@ -919,9 +923,9 @@ class TiramisuContextConfig(TiramisuContext):
|
||||
first: bool=False):
|
||||
"""find a path from option name and optionnaly a value to MetaConfig or GroupConfig"""
|
||||
if first:
|
||||
return self.config_bag.context.find_firsts(byname=name,
|
||||
byvalue=value,
|
||||
config_bag=self.config_bag)
|
||||
return TiramisuAPI(self.config_bag.context.find_firsts(byname=name,
|
||||
byvalue=value,
|
||||
config_bag=self.config_bag))
|
||||
else:
|
||||
raise APIError('not implemented yet')
|
||||
|
||||
|
@ -181,7 +181,8 @@ class ConfigBag:
|
||||
return 'validator' in self._setting_properties
|
||||
return self._validate
|
||||
if key == 'setting_properties':
|
||||
if self.force_unrestraint or not self._validate:
|
||||
#if self.force_unrestraint or not self._validate:
|
||||
if self.force_unrestraint:
|
||||
return None
|
||||
return self._setting_properties
|
||||
if key == '_setting_properties':
|
||||
@ -196,6 +197,11 @@ class ConfigBag:
|
||||
def __setattr__(self, key, value):
|
||||
if key == 'validate':
|
||||
self._validate = value
|
||||
#FIXME
|
||||
try:
|
||||
del self._setting_properties
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
super().__setattr__(key, value)
|
||||
|
||||
|
Reference in New Issue
Block a user