config is context in ConfigBag

This commit is contained in:
2018-08-02 22:35:40 +02:00
parent c46480a7eb
commit 81666b6303
12 changed files with 123 additions and 270 deletions

View File

@ -173,7 +173,7 @@ class CacheOptionDescription(BaseOption):
'"force_store_value" property').format(
option.impl_get_display_name()))
if not values._p_.hasvalue(subpath):
config_bag = ConfigBag(config=context)
config_bag = ConfigBag(context=context)
option_bag = OptionBag()
option_bag.set_option(option,
subpath,
@ -233,7 +233,7 @@ class OptionDescriptionWalk(CacheOptionDescription):
rootpath = self.impl_get_path_by_opt(dynopt)
ori_index = len(rootpath) + 1
subpaths = [rootpath] + option.impl_getpath(
option_bag.config_bag.config)[ori_index:].split('.')[:-1]
option_bag.config_bag.context)[ori_index:].split('.')[:-1]
for suffix in dynopt._impl_get_suffixes(option_bag):
subpath = '.'.join([subp + suffix for subp in subpaths])
if isinstance(option, OnlyOption):
@ -268,7 +268,7 @@ class OptionDescriptionWalk(CacheOptionDescription):
config_bag)
for doption in self.build_dynoptions(option_bag):
if byname == doption.impl_getname():
dpath = doption.impl_getpath(config_bag.config)
dpath = doption.impl_getpath(config_bag.context)
return (dpath, doption)
elif byname == name:
return (path, option)
@ -321,13 +321,13 @@ class OptionDescriptionWalk(CacheOptionDescription):
subpath = None
for child in self._impl_st_getchildren():
if dyn and child.impl_is_dynoptiondescription():
if config_bag.config is None: # pragma: no cover
if config_bag.context is None: # pragma: no cover
raise ConfigError(_('need context'))
if subpath is None:
if config_bag.config.cfgimpl_get_description() == self:
if config_bag.context.cfgimpl_get_description() == self:
subpath = ''
else:
subpath = self.impl_getpath(config_bag.config)
subpath = self.impl_getpath(config_bag.context)
option_bag = OptionBag()
option_bag.set_option(child,
subpath,