calculation with submulti

This commit is contained in:
Emmanuel Garette 2021-03-18 08:57:22 +01:00
parent 668ed3ad37
commit 29282d8ea3
1 changed files with 15 additions and 5 deletions

View File

@ -69,11 +69,21 @@ class Leadership(OptionDescription):
child.impl_get_display_name())) child.impl_get_display_name()))
if idx != 0: if idx != 0:
default = child.impl_getdefault() default = child.impl_getdefault()
if default != [] and not isinstance(default, Calculation): if default != []:
raise ValueError(_('not allowed default value for follower option "{0}" ' if child.impl_is_submulti() and isinstance(default, tuple):
'in leadership "{1}"' for val in default:
'').format(child.impl_get_display_name(), if not isinstance(val, Calculation):
self.impl_get_display_name())) calculation = False
else:
# empty default is valid
calculation = True
else:
calculation = isinstance(default, Calculation)
if not calculation:
raise ValueError(_('not allowed default value for follower option "{0}" '
'in leadership "{1}"'
'').format(child.impl_get_display_name(),
self.impl_get_display_name()))
if idx != 0: if idx != 0:
# remove empty property for follower # remove empty property for follower
child._properties = frozenset(child._properties - {'empty', 'unique'}) child._properties = frozenset(child._properties - {'empty', 'unique'})