check uniq value for a slave
This commit is contained in:
parent
58a90a3707
commit
7977efe246
|
@ -241,6 +241,13 @@ def test_consistency_not_equal_masterslave():
|
||||||
c.a = [1]
|
c.a = [1]
|
||||||
raises(ValueError, "c.b = [1]")
|
raises(ValueError, "c.b = [1]")
|
||||||
c.b = [2]
|
c.b = [2]
|
||||||
|
del(c.a)
|
||||||
|
c.a.append(1)
|
||||||
|
c.make_dict()
|
||||||
|
c.b[0] = 3
|
||||||
|
c.a.append(2)
|
||||||
|
c.b[0] = 3
|
||||||
|
raises(ValueError, "c.b[1] = 3")
|
||||||
|
|
||||||
|
|
||||||
def test_consistency_not_equal_masterslaves_default():
|
def test_consistency_not_equal_masterslaves_default():
|
||||||
|
|
|
@ -661,7 +661,13 @@ class Option(OnlyOption):
|
||||||
if err:
|
if err:
|
||||||
return err
|
return err
|
||||||
else:
|
else:
|
||||||
if self.impl_is_unique() and value in multi:
|
if multi is not None and self.impl_is_unique() and value in multi:
|
||||||
|
if not self.impl_is_submulti() and len(multi) - 1 >= force_index:
|
||||||
|
lst = list(multi)
|
||||||
|
lst.pop(force_index)
|
||||||
|
else:
|
||||||
|
lst = multi
|
||||||
|
if value in lst:
|
||||||
return ValueError(_('invalid value "{}", this value is already'
|
return ValueError(_('invalid value "{}", this value is already'
|
||||||
' in "{}"').format(value,
|
' in "{}"').format(value,
|
||||||
self.impl_get_display_name()))
|
self.impl_get_display_name()))
|
||||||
|
|
Loading…
Reference in New Issue