fix: better error message
This commit is contained in:
parent
888ba21551
commit
db82dd6d41
6 changed files with 53 additions and 51 deletions
|
|
@ -2,7 +2,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: Tiramisu\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-03-19 09:51+0100\n"
|
||||
"POT-Creation-Date: 2025-04-09 08:14+0200\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n"
|
||||
"Language-Team: Tiramisu's team <egarette@cadoles.com>\n"
|
||||
|
|
@ -90,7 +90,7 @@ msgstr ""
|
|||
msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\""
|
||||
msgstr "ne peut trouver \"{0}\" dans l'option \"{1}\" à l'index \"{2}\""
|
||||
|
||||
#: tiramisu/api.py:679
|
||||
#: tiramisu/api.py:679 tiramisu/option/optiondescription.py:283
|
||||
msgid "cannot find \"{0}\""
|
||||
msgstr "ne peut trouver \"{0}\""
|
||||
|
||||
|
|
@ -619,7 +619,7 @@ msgstr "ne doit pas être une IP"
|
|||
msgid "some characters are uppercase"
|
||||
msgstr "des caractères sont en majuscule"
|
||||
|
||||
#: tiramisu/option/dynoptiondescription.py:131
|
||||
#: tiramisu/option/dynoptiondescription.py:130
|
||||
msgid "DynOptionDescription identifiers for option {0}, is not a list ({1})"
|
||||
msgstr ""
|
||||
"les identifiants de la DynOptionDescription pour l'option {0}, n'est pas une "
|
||||
|
|
@ -806,41 +806,34 @@ msgstr "lequel \"{}\" doit être une liste de liste"
|
|||
msgid "duplicate option: {0}"
|
||||
msgstr "option dupliquée : {0}"
|
||||
|
||||
#: tiramisu/option/optiondescription.py:244
|
||||
msgid ""
|
||||
"unknown option \"{0}\" in root optiondescription (it's a dynamic option)"
|
||||
msgstr ""
|
||||
"option \"{0}\" inconnue dans l'optiondescription racine (c'est une option "
|
||||
"dynamique)"
|
||||
#: tiramisu/option/optiondescription.py:249
|
||||
msgid "cannot access to \"{0}\" it's a dynamic option"
|
||||
msgstr "ne peut accéder à \"{0}\" c'est une option dynamique"
|
||||
|
||||
#: tiramisu/option/optiondescription.py:279
|
||||
msgid "unknown option \"{0}\" in root optiondescription"
|
||||
msgstr "option \"{0}\" inconnue dans l'optiondescription racine"
|
||||
#: tiramisu/option/optiondescription.py:286
|
||||
msgid "cannot find \"{0}\" in \"{1}\""
|
||||
msgstr "ne peut pas trouver \"{0}\" dans \"{1}\""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:282
|
||||
msgid "unknown option \"{0}\" in optiondescription {1}"
|
||||
msgstr "option \"{0}\" inconnue dans l'optiondescription {1}"
|
||||
|
||||
#: tiramisu/option/optiondescription.py:338
|
||||
#: tiramisu/option/optiondescription.py:342
|
||||
msgid "children in optiondescription \"{}\" must be a list"
|
||||
msgstr "les enfants d'une optiondescription \"{}\" doivent être une liste"
|
||||
|
||||
#: tiramisu/option/optiondescription.py:366
|
||||
#: tiramisu/option/optiondescription.py:370
|
||||
msgid "duplicate option name: \"{0}\""
|
||||
msgstr "nom de l'option dupliqué : \"{0}\""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:372
|
||||
#: tiramisu/option/optiondescription.py:376
|
||||
msgid ""
|
||||
"the option's name \"{0}\" start as the dynoptiondescription's name \"{1}\""
|
||||
msgstr ""
|
||||
"le nom de l'option \"{0}\" commence comme le nom du dynoptiondescription "
|
||||
"\"{1}\""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:415
|
||||
#: tiramisu/option/optiondescription.py:419
|
||||
msgid "cannot change group_type if already set (old {0}, new {1})"
|
||||
msgstr "ne peut changer group_type si déjà spécifié (ancien {0}, nouveau {1})"
|
||||
|
||||
#: tiramisu/option/optiondescription.py:420
|
||||
#: tiramisu/option/optiondescription.py:424
|
||||
msgid "group_type: {0} not allowed"
|
||||
msgstr "group_type : {0} non autorisé"
|
||||
|
||||
|
|
@ -1028,8 +1021,17 @@ msgstr ""
|
|||
msgid "information's item not found \"{}\""
|
||||
msgstr "l'information de l'objet ne sont pas trouvé \"{}\""
|
||||
|
||||
#~ msgid "cannot find {0} \"{1}\""
|
||||
#~ msgstr "ne peut pas trouver {0} \"{1}\""
|
||||
#~ msgid ""
|
||||
#~ "unknown option \"{0}\" in root optiondescription (it's a dynamic option)"
|
||||
#~ msgstr ""
|
||||
#~ "option \"{0}\" inconnue dans l'optiondescription racine (c'est une option "
|
||||
#~ "dynamique)"
|
||||
|
||||
#~ msgid "unknown option \"{0}\" in root optiondescription"
|
||||
#~ msgstr "option \"{0}\" inconnue dans l'optiondescription racine"
|
||||
|
||||
#~ msgid "unknown option \"{0}\" in optiondescription {1}"
|
||||
#~ msgstr "option \"{0}\" inconnue dans l'optiondescription {1}"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "IP \"{ip[\"value\"]}\" ({ip[\"name\"]}) with this netmask is in fact a "
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2025-03-19 09:54+0100\n"
|
||||
"POT-Creation-Date: 2025-04-09 08:16+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -79,7 +79,7 @@ msgstr ""
|
|||
msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\""
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/api.py:679
|
||||
#: tiramisu/api.py:679 tiramisu/option/optiondescription.py:283
|
||||
msgid "cannot find \"{0}\""
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ msgstr ""
|
|||
msgid "some characters are uppercase"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/dynoptiondescription.py:131
|
||||
#: tiramisu/option/dynoptiondescription.py:130
|
||||
msgid "DynOptionDescription identifiers for option {0}, is not a list ({1})"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -700,35 +700,31 @@ msgstr ""
|
|||
msgid "duplicate option: {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:244
|
||||
msgid "unknown option \"{0}\" in root optiondescription (it's a dynamic option)"
|
||||
#: tiramisu/option/optiondescription.py:249
|
||||
msgid "cannot access to \"{0}\" it's a dynamic option"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:279
|
||||
msgid "unknown option \"{0}\" in root optiondescription"
|
||||
#: tiramisu/option/optiondescription.py:286
|
||||
msgid "cannot find \"{0}\" in \"{1}\""
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:282
|
||||
msgid "unknown option \"{0}\" in optiondescription {1}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:338
|
||||
#: tiramisu/option/optiondescription.py:342
|
||||
msgid "children in optiondescription \"{}\" must be a list"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:366
|
||||
#: tiramisu/option/optiondescription.py:370
|
||||
msgid "duplicate option name: \"{0}\""
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:372
|
||||
#: tiramisu/option/optiondescription.py:376
|
||||
msgid "the option's name \"{0}\" start as the dynoptiondescription's name \"{1}\""
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:415
|
||||
#: tiramisu/option/optiondescription.py:419
|
||||
msgid "cannot change group_type if already set (old {0}, new {1})"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option/optiondescription.py:420
|
||||
#: tiramisu/option/optiondescription.py:424
|
||||
msgid "group_type: {0} not allowed"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
|
|
@ -380,12 +380,12 @@ def test_prefix_error():
|
|||
try:
|
||||
cfg.option('test1').value.set('yes')
|
||||
except Exception as err:
|
||||
assert str(err) == _('"{0}" is an invalid {1} for "{2}"').format('yes', _('integer'), 'test1')
|
||||
assert str(err) == _('"{0}" is an invalid {1} for "{2}", which is not an integer').format('yes', _('integer'), 'test1')
|
||||
try:
|
||||
cfg.option('test1').value.set('yes')
|
||||
except Exception as err:
|
||||
err.prefix = ''
|
||||
assert str(err) == _('invalid value')
|
||||
assert str(err) == _('which is not an integer')
|
||||
# assert not list_sessions()
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -124,7 +124,6 @@ class DynOptionDescription(OptionDescription):
|
|||
)[0]
|
||||
if values is None:
|
||||
values = []
|
||||
values_ = []
|
||||
if __debug__:
|
||||
if not isinstance(values, list):
|
||||
raise ValueError(
|
||||
|
|
@ -134,6 +133,7 @@ class DynOptionDescription(OptionDescription):
|
|||
self.impl_get_display_name(subconfig, with_quote=True), values
|
||||
)
|
||||
)
|
||||
values_ = []
|
||||
for val in values:
|
||||
cval = self.convert_identifier_to_path(val)
|
||||
if not isinstance(cval, str) or re.match(NAME_REGEXP, cval) is None:
|
||||
|
|
|
|||
|
|
@ -232,18 +232,21 @@ class OptionDescriptionWalk(CacheOptionDescription):
|
|||
|
||||
def get_child_not_dynamic(
|
||||
self,
|
||||
name,
|
||||
allow_dynoption,
|
||||
name: str,
|
||||
allow_dynoption: bool,
|
||||
parent: "SubConfig",
|
||||
):
|
||||
if name in self._children[0]: # pylint: disable=no-member
|
||||
option = self._children[1][
|
||||
self._children[0].index(name)
|
||||
] # pylint: disable=no-member
|
||||
if option.impl_is_dynoptiondescription() and not allow_dynoption:
|
||||
if parent.path:
|
||||
path = parent.path + '.' + name
|
||||
else:
|
||||
path = name
|
||||
raise AttributeError(
|
||||
_(
|
||||
'unknown option "{0}" in root optiondescription (it\'s a dynamic option)'
|
||||
).format(name)
|
||||
_('cannot access to "{0}" it\'s a dynamic option').format(path)
|
||||
)
|
||||
return option
|
||||
|
||||
|
|
@ -261,6 +264,7 @@ class OptionDescriptionWalk(CacheOptionDescription):
|
|||
option = self.get_child_not_dynamic(
|
||||
name,
|
||||
allow_dynoption,
|
||||
parent,
|
||||
)
|
||||
if option:
|
||||
return option
|
||||
|
|
@ -274,13 +278,13 @@ class OptionDescriptionWalk(CacheOptionDescription):
|
|||
if not with_identifier:
|
||||
return child
|
||||
return identifier, child
|
||||
if self.impl_get_group_type() == groups.root: # pylint: disable=no-member
|
||||
if parent.path is None:
|
||||
raise AttributeError(
|
||||
_('unknown option "{0}" in root optiondescription').format(name)
|
||||
_('cannot find "{0}"').format(name)
|
||||
)
|
||||
raise AttributeError(
|
||||
_('unknown option "{0}" in optiondescription {1}').format(
|
||||
name, self.impl_get_display_name(parent, with_quote=True)
|
||||
_('cannot find "{0}" in "{1}"').format(
|
||||
name, parent.path
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue