Commit 6f0d3d67 authored by Jérome Perrin's avatar Jérome Perrin

Fix set value accessors (like setRegionValueSet).

They were not filtering out duplicates


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34681 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 477c01ca
......@@ -48,7 +48,8 @@ class SetSetter(BaseSetter):
def __call__(self, instance, *args, **kw):
if self._warning:
LOG("ERP5Type Deprecated Setter Id:",0, self._id)
instance._setValue(self._key, args[0],
value = set(args[0])
instance._setValue(self._key, value,
spec=kw.get('spec',()),
filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()),
......
......@@ -2004,7 +2004,7 @@ class Base( CopyContainer,
# We have been provided a string
path = target
if path.startswith(start_string): path = path[start_string_len:] # Prevent duplicating base category
elif isinstance(target, (tuple, list)):
elif isinstance(target, (tuple, list, set, frozenset)):
# We have been provided a list or tuple
path_list = []
for target_item in target:
......
......@@ -675,6 +675,7 @@ class TestPropertySheet:
person.setRegionValueList([alpha, alpha])
self.assertEquals(person.getRegionList(), ['alpha', 'alpha'])
person.setRegionValueSet([alpha, alpha])
self.assertEquals(person.getRegionList(), ['alpha'])
self.assertEquals(person.getRegionSet(), ['alpha'])
person.setRegionValueList([alpha, beta, alpha])
self.assertEquals(person.getRegionList(), ['alpha', 'beta', 'alpha'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment