submulti
This commit is contained in:
@ -353,7 +353,7 @@ class Base(object):
|
||||
return not isinstance(getattr(self, '_informations', dict()), dict)
|
||||
|
||||
def impl_getproperties(self):
|
||||
return getattr(self, '_properties', STATIC_TUPLE)
|
||||
return getattr(self, '_properties', frozenset())
|
||||
|
||||
def _set_readonly(self):
|
||||
if not self.impl_is_readonly():
|
||||
|
@ -71,7 +71,7 @@ class MasterSlaves(OptionDescription):
|
||||
if idx != 0:
|
||||
properties = list(child._properties)
|
||||
properties.remove('empty')
|
||||
child._properties = tuple(properties)
|
||||
child._properties = frozenset(properties)
|
||||
slaves.append(child)
|
||||
child._add_dependency(self)
|
||||
child._master_slaves = weakref.ref(self)
|
||||
|
@ -247,8 +247,7 @@ class Option(OnlyOption):
|
||||
def do_validation(_value,
|
||||
_index):
|
||||
if isinstance(_value, list): # pragma: no cover
|
||||
raise ValueError(_('invalid value "{}" for "{}" '
|
||||
'which must not be a list').format(_value,
|
||||
raise ValueError(_('which must not be a list').format(_value,
|
||||
self.impl_get_display_name()))
|
||||
#FIXME a revoir ...
|
||||
if _value is not None:
|
||||
@ -278,6 +277,8 @@ class Option(OnlyOption):
|
||||
do_validation(val, None)
|
||||
elif force_index is not None:
|
||||
if self.impl_is_submulti():
|
||||
if not isinstance(value, list):
|
||||
raise ValueError(_('which must be a list'))
|
||||
_is_not_unique(value)
|
||||
for idx, val in enumerate(value):
|
||||
do_validation(val,
|
||||
@ -290,23 +291,17 @@ class Option(OnlyOption):
|
||||
else:
|
||||
lst = multi
|
||||
if value in lst:
|
||||
raise ValueError(_('invalid value "{}", this value is already'
|
||||
' in "{}"').format(value,
|
||||
self.impl_get_display_name()))
|
||||
raise ValueError(_('this value is not uniq'))
|
||||
do_validation(val,
|
||||
force_index)
|
||||
elif not isinstance(value, list):
|
||||
raise ValueError(_('invalid value "{0}" for "{1}" which '
|
||||
'must be a list').format(value,
|
||||
self.impl_getname()))
|
||||
raise ValueError(_('which must be a list'))
|
||||
elif self.impl_is_submulti():
|
||||
for idx, lval in enumerate(value):
|
||||
_is_not_unique(lval)
|
||||
if not isinstance(lval, list):
|
||||
raise ValueError(_('invalid value "{0}" for "{1}" '
|
||||
'which must be a list of list'
|
||||
'').format(lval,
|
||||
self.impl_getname()))
|
||||
raise ValueError(_('which "{}" must be a list of list'
|
||||
'').format(lval))
|
||||
for val in lval:
|
||||
do_validation(val,
|
||||
idx)
|
||||
|
Reference in New Issue
Block a user