validate value before validate unique value
This commit is contained in:
parent
91c44b38bc
commit
6b33bddbac
1 changed files with 5 additions and 5 deletions
|
@ -267,11 +267,11 @@ class Option(BaseOption):
|
||||||
else:
|
else:
|
||||||
raise err
|
raise err
|
||||||
try:
|
try:
|
||||||
|
err_index = None
|
||||||
if isinstance(value, Calculation):
|
if isinstance(value, Calculation):
|
||||||
pass
|
pass
|
||||||
elif not self.impl_is_multi():
|
elif not self.impl_is_multi():
|
||||||
val = value
|
val = value
|
||||||
err_index = None
|
|
||||||
do_validation(val, None)
|
do_validation(val, None)
|
||||||
elif self.impl_is_submulti():
|
elif self.impl_is_submulti():
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
|
@ -297,7 +297,7 @@ class Option(BaseOption):
|
||||||
do_validation(val,
|
do_validation(val,
|
||||||
err_index)
|
err_index)
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
raise ValueOptionError(val,
|
raise ValueOptionError(value,
|
||||||
self._display_name,
|
self._display_name,
|
||||||
option_bag.ori_option,
|
option_bag.ori_option,
|
||||||
'{0}'.format(err),
|
'{0}'.format(err),
|
||||||
|
@ -407,10 +407,10 @@ class Option(BaseOption):
|
||||||
if self.impl_is_submulti():
|
if self.impl_is_submulti():
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
raise ValueError(_('which must be a list'))
|
raise ValueError(_('which must be a list'))
|
||||||
_is_not_unique(value, option_bag)
|
|
||||||
for val in value:
|
for val in value:
|
||||||
await do_validation(val,
|
await do_validation(val,
|
||||||
force_index)
|
force_index)
|
||||||
|
_is_not_unique(value, option_bag)
|
||||||
else:
|
else:
|
||||||
await do_validation(val,
|
await do_validation(val,
|
||||||
force_index)
|
force_index)
|
||||||
|
@ -420,7 +420,6 @@ class Option(BaseOption):
|
||||||
raise ValueError(_('which must be a list'))
|
raise ValueError(_('which must be a list'))
|
||||||
elif self.impl_is_submulti():
|
elif self.impl_is_submulti():
|
||||||
for err_index, lval in enumerate(value):
|
for err_index, lval in enumerate(value):
|
||||||
_is_not_unique(lval, option_bag)
|
|
||||||
if isinstance(lval, Calculation):
|
if isinstance(lval, Calculation):
|
||||||
continue
|
continue
|
||||||
if not isinstance(lval, list):
|
if not isinstance(lval, list):
|
||||||
|
@ -429,12 +428,13 @@ class Option(BaseOption):
|
||||||
for val in lval:
|
for val in lval:
|
||||||
await do_validation(val,
|
await do_validation(val,
|
||||||
err_index)
|
err_index)
|
||||||
|
_is_not_unique(lval, option_bag)
|
||||||
else:
|
else:
|
||||||
_is_not_unique(value, option_bag)
|
|
||||||
# FIXME subtimal, not several time is whole=True!
|
# FIXME subtimal, not several time is whole=True!
|
||||||
for err_index, val in enumerate(value):
|
for err_index, val in enumerate(value):
|
||||||
await do_validation(val,
|
await do_validation(val,
|
||||||
err_index)
|
err_index)
|
||||||
|
_is_not_unique(value, option_bag)
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
if config_bag is undefined or \
|
if config_bag is undefined or \
|
||||||
'demoting_error_warning' not in config_bag.properties:
|
'demoting_error_warning' not in config_bag.properties:
|
||||||
|
|
Loading…
Reference in a new issue