better multi support
This commit is contained in:
parent
0b2f13404c
commit
4b052c3943
1 changed files with 6 additions and 7 deletions
|
@ -266,14 +266,13 @@ class Option(BaseOption):
|
|||
option_bag: OptionBag,
|
||||
check_error: bool=True,
|
||||
loaded: bool=False,
|
||||
) -> None:
|
||||
) -> bool:
|
||||
"""Return True if value is really valid
|
||||
If not validate or invalid return it returns False
|
||||
"""
|
||||
config_bag = option_bag.config_bag
|
||||
force_index = option_bag.index
|
||||
is_warnings_only = getattr(self, '_warnings_only', False)
|
||||
|
||||
if check_error and config_bag is not undefined and \
|
||||
not 'validator' in config_bag.properties:
|
||||
return False
|
||||
|
@ -363,9 +362,9 @@ class Option(BaseOption):
|
|||
calculation_validator(_value,
|
||||
_index,
|
||||
)
|
||||
try:
|
||||
val = value
|
||||
err_index = force_index
|
||||
try:
|
||||
if not self.impl_is_multi():
|
||||
do_validation(val, None)
|
||||
elif force_index is not None:
|
||||
|
@ -385,8 +384,6 @@ class Option(BaseOption):
|
|||
)
|
||||
elif isinstance(value, Calculation) and config_bag is undefined:
|
||||
pass
|
||||
elif not isinstance(value, list):
|
||||
raise ValueError(_('which must be a list'))
|
||||
elif self.impl_is_submulti():
|
||||
for err_index, lval in enumerate(value):
|
||||
if isinstance(lval, Calculation):
|
||||
|
@ -398,8 +395,10 @@ class Option(BaseOption):
|
|||
do_validation(val,
|
||||
err_index)
|
||||
_is_not_unique(lval, option_bag)
|
||||
elif not isinstance(value, list):
|
||||
raise ValueError(_('which must be a list'))
|
||||
else:
|
||||
# FIXME suboptimal, not several time is whole=True!
|
||||
# FIXME suboptimal, not several time for whole=True!
|
||||
for err_index, val in enumerate(value):
|
||||
do_validation(val,
|
||||
err_index,
|
||||
|
|
Loading…
Reference in a new issue