validate value before validate unique value
This commit is contained in:
parent
91c44b38bc
commit
6b33bddbac
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue