suffix can have a none str value

This commit is contained in:
Emmanuel Garette 2022-10-01 19:33:04 +02:00
parent 7f78728ad1
commit 89c095e0d3
3 changed files with 6 additions and 12 deletions

View file

@ -279,9 +279,7 @@ async def manager_callback(callbk: Param,
except ValueError as err: except ValueError as err:
raise ValueError(_('the option "{0}" is used in a calculation but is invalid ({1})').format(option_bag.option.impl_get_display_name(), err)) raise ValueError(_('the option "{0}" is used in a calculation but is invalid ({1})').format(option_bag.option.impl_get_display_name(), err))
except AttributeError as err: except AttributeError as err:
raise ConfigError(_('impossible to calculate "{0}", {1}').format(option_bag.option.impl_get_display_name(), raise ConfigError(_(f'unable to get value for calculating "{option_bag.option.impl_get_display_name()}", {err}'))
err,
))
return value return value
async def get_option_bag(config_bag, async def get_option_bag(config_bag,

View file

@ -106,7 +106,6 @@ class SubConfig:
desc, desc,
resetted_opts, resetted_opts,
option_bag): option_bag):
if option_bag.path in resetted_opts: if option_bag.path in resetted_opts:
return return
resetted_opts.append(option_bag.path) resetted_opts.append(option_bag.path)
@ -185,16 +184,13 @@ class SubConfig:
context = self.cfgimpl_get_context() context = self.cfgimpl_get_context()
desc = context.cfgimpl_get_description() desc = context.cfgimpl_get_description()
if option_bag is not None: if option_bag is not None:
if 'cache' in option_bag.config_bag.properties: if 'cache' not in option_bag.config_bag.properties:
has_cache = True return
option_bag.config_bag.properties = option_bag.config_bag.properties - {'cache'} option_bag.config_bag.properties = option_bag.config_bag.properties - {'cache'}
else:
has_cache = False
await self.reset_one_option_cache(desc, await self.reset_one_option_cache(desc,
resetted_opts, resetted_opts,
option_bag) option_bag)
if has_cache: option_bag.config_bag.properties = option_bag.config_bag.properties | {'cache'}
option_bag.config_bag.properties = option_bag.config_bag.properties | {'cache'}
else: else:
context._impl_values_cache.reset_all_cache() context._impl_values_cache.reset_all_cache()
context._impl_properties_cache.reset_all_cache() context._impl_properties_cache.reset_all_cache()

View file

@ -119,7 +119,7 @@ class SynDynOptionDescription:
return rootpath + self.impl_getname() return rootpath + self.impl_getname()
def impl_get_display_name(self) -> str: def impl_get_display_name(self) -> str:
return self.opt.impl_get_display_name() + self._suffix return self.opt.impl_get_display_name() + str(self._suffix)
class SynDynLeadership(SynDynOptionDescription): class SynDynLeadership(SynDynOptionDescription):