From 6b33bddbac6b04f09cc9155c00de5b1bb308838f Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 18 Feb 2020 22:09:53 +0100 Subject: [PATCH] validate value before validate unique value --- tiramisu/option/option.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tiramisu/option/option.py b/tiramisu/option/option.py index 39fd1f2..d28092f 100644 --- a/tiramisu/option/option.py +++ b/tiramisu/option/option.py @@ -267,11 +267,11 @@ class Option(BaseOption): else: raise err try: + err_index = None if isinstance(value, Calculation): pass elif not self.impl_is_multi(): val = value - err_index = None do_validation(val, None) elif self.impl_is_submulti(): if not isinstance(value, list): @@ -297,7 +297,7 @@ class Option(BaseOption): do_validation(val, err_index) except ValueError as err: - raise ValueOptionError(val, + raise ValueOptionError(value, self._display_name, option_bag.ori_option, '{0}'.format(err), @@ -407,10 +407,10 @@ class Option(BaseOption): if self.impl_is_submulti(): if not isinstance(value, list): raise ValueError(_('which must be a list')) - _is_not_unique(value, option_bag) for val in value: await do_validation(val, force_index) + _is_not_unique(value, option_bag) else: await do_validation(val, force_index) @@ -420,7 +420,6 @@ class Option(BaseOption): raise ValueError(_('which must be a list')) elif self.impl_is_submulti(): for err_index, lval in enumerate(value): - _is_not_unique(lval, option_bag) if isinstance(lval, Calculation): continue if not isinstance(lval, list): @@ -429,12 +428,13 @@ class Option(BaseOption): for val in lval: await do_validation(val, err_index) + _is_not_unique(lval, option_bag) else: - _is_not_unique(value, option_bag) # FIXME subtimal, not several time is whole=True! for err_index, val in enumerate(value): await do_validation(val, err_index) + _is_not_unique(value, option_bag) except ValueError as err: if config_bag is undefined or \ 'demoting_error_warning' not in config_bag.properties: