make_dict => dict, option.dict => config.dict
This commit is contained in:
@ -517,19 +517,24 @@ class TiramisuOption(CommonTiramisu):
|
||||
return getattr(self, '_' + subfunc)
|
||||
raise APIError(_('please specify a valid sub function ({})').format(subfunc))
|
||||
|
||||
def _make_dict(self,
|
||||
flatten=False,
|
||||
withvalue=undefined,
|
||||
withoption=None,
|
||||
fullpath=False):
|
||||
"""return dict with path as key and value for an optiondescription (only for optiondescription)"""
|
||||
def dict(self,
|
||||
flatten=False,
|
||||
withvalue=undefined,
|
||||
withoption=None,
|
||||
fullpath=False):
|
||||
"""return dict with path as key and value (only for optiondescription)"""
|
||||
self._get_option()
|
||||
return self.config_bag.context.get_subconfig(self._path,
|
||||
self.option_bag).make_dict(config_bag=self.config_bag,
|
||||
flatten=flatten,
|
||||
fullpath=fullpath,
|
||||
withoption=withoption,
|
||||
withvalue=withvalue)
|
||||
if not self.config_bag.properties:
|
||||
config_bag = self.config_bag
|
||||
else:
|
||||
config_bag = self.config_bag.copy()
|
||||
config_bag.properties = self.config_bag.properties - {'warnings'}
|
||||
return config_bag.context.get_subconfig(self._path,
|
||||
self.option_bag).make_dict(config_bag=config_bag,
|
||||
flatten=flatten,
|
||||
fullpath=fullpath,
|
||||
withoption=withoption,
|
||||
withvalue=withvalue)
|
||||
|
||||
def _find(self,
|
||||
name: str,
|
||||
@ -739,7 +744,8 @@ class TiramisuContextProperty(TiramisuContext):
|
||||
settings = self.config_bag.context.cfgimpl_get_settings()
|
||||
settings.read_write()
|
||||
# #FIXME ?
|
||||
settings.set_context_permissives(frozenset(['hidden']))
|
||||
permissives = frozenset(settings.get_context_permissives() | frozenset(['hidden']))
|
||||
settings.set_context_permissives(permissives)
|
||||
try:
|
||||
del self.config_bag.properties
|
||||
except AttributeError:
|
||||
@ -843,23 +849,6 @@ class TiramisuContextOption(TiramisuContext):
|
||||
self.config_bag.context,
|
||||
self.config_bag)
|
||||
|
||||
def make_dict(self,
|
||||
flatten=False,
|
||||
withvalue=undefined,
|
||||
withoption=None,
|
||||
fullpath=False):
|
||||
"""return dict with path as key and value"""
|
||||
if not self.config_bag.properties:
|
||||
config_bag = self.config_bag
|
||||
else:
|
||||
config_bag = self.config_bag.copy()
|
||||
config_bag.properties = self.config_bag.properties - {'warnings'}
|
||||
return config_bag.context.make_dict(config_bag,
|
||||
flatten=flatten,
|
||||
fullpath=fullpath,
|
||||
withoption=withoption,
|
||||
withvalue=withvalue)
|
||||
|
||||
def list(self,
|
||||
type='all',
|
||||
group_type=None,
|
||||
@ -956,6 +945,23 @@ class TiramisuContextConfig(TiramisuContext):
|
||||
raise APIError(_('{} is unknown').format(name))
|
||||
raise APIError(_('{} is unknown').format(name))
|
||||
|
||||
def dict(self,
|
||||
flatten=False,
|
||||
withvalue=undefined,
|
||||
withoption=None,
|
||||
fullpath=False):
|
||||
"""return dict with path as key and value"""
|
||||
if not self.config_bag.properties:
|
||||
config_bag = self.config_bag
|
||||
else:
|
||||
config_bag = self.config_bag.copy()
|
||||
config_bag.properties = self.config_bag.properties - {'warnings'}
|
||||
return config_bag.context.make_dict(config_bag,
|
||||
flatten=flatten,
|
||||
fullpath=fullpath,
|
||||
withoption=withoption,
|
||||
withvalue=withvalue)
|
||||
|
||||
|
||||
class TiramisuDispatcher:
|
||||
pass
|
||||
|
Reference in New Issue
Block a user