config_bag and name not already exists

This commit is contained in:
Emmanuel Garette 2020-08-15 00:23:48 +02:00
parent 50d42624cc
commit afeedc1db6
2 changed files with 5 additions and 5 deletions

View File

@ -87,8 +87,8 @@ class CommonTiramisu(TiramisuHelp):
async def _get_option(self, async def _get_option(self,
connection) -> Any: connection) -> Any:
if not self._subconfig:
config_bag = self._option_bag.config_bag config_bag = self._option_bag.config_bag
if not self._subconfig:
try: try:
subconfig, name = await config_bag.context.cfgimpl_get_home_by_path(self._option_bag.path, subconfig, name = await config_bag.context.cfgimpl_get_home_by_path(self._option_bag.path,
config_bag, config_bag,
@ -101,7 +101,7 @@ class CommonTiramisu(TiramisuHelp):
self._name = name self._name = name
option = self._option_bag.option option = self._option_bag.option
if option is None: if option is None:
option = await self._subconfig.cfgimpl_get_description().get_child(name, option = await self._subconfig.cfgimpl_get_description().get_child(self._name,
config_bag, config_bag,
self._subconfig.cfgimpl_get_path()) self._subconfig.cfgimpl_get_path())
self._option_bag.option = option self._option_bag.option = option

View File

@ -64,11 +64,11 @@ class SubConfig:
(not isinstance(descr, (BaseOption, SynDynOptionDescription)) or (not isinstance(descr, (BaseOption, SynDynOptionDescription)) or
not descr.impl_is_optiondescription()): not descr.impl_is_optiondescription()):
try: try:
msg = descr.impl_get_displayname() msg = descr.impl_get_display_name()
except AttributeError: except AttributeError:
msg = descr msg = descr
raise TypeError(_('"{0}" must be an optiondescription, not an {1}' raise TypeError(_('cannot create a sub config for "{0}" this is a "{1}", not an "OptionDescription"'
).format(msg, type(descr))) ).format(msg, descr.__class__.__name__))
self._impl_descr = descr self._impl_descr = descr
self._impl_context = context self._impl_context = context
self._impl_path = subpath self._impl_path = subpath