better error when value not in a choice

This commit is contained in:
Emmanuel Garette 2021-03-18 08:54:59 +01:00
parent da946baba6
commit 668ed3ad37
3 changed files with 6 additions and 3 deletions

View File

@ -20,6 +20,8 @@ from .i18n import _
def display_list(lst, separator='and', add_quote=False):
if not lst:
return '""'
if separator == 'and':
separator = _('and')
elif separator == 'or':

View File

@ -60,8 +60,8 @@ class ChoiceOption(Option):
if isinstance(self._choice_values, Calculation):
values = await self._choice_values.execute(option_bag)
if values is not undefined and not isinstance(values, list):
raise ConfigError(_('calculated values for {0} is not a list'
'').format(self.impl_getname()))
raise ConfigError(_('the calculated values "{0}" for "{1}" is not a list'
'').format(values, self.impl_getname()))
else:
values = self._choice_values
return values

View File

@ -84,7 +84,8 @@ class SynDynOptionDescription:
async def get_children(self,
config_bag: ConfigBag,
dyn: bool=True):
dyn: bool=True,
):
subpath = self.impl_getpath()
children = []
for child in await self._opt.get_children(config_bag):