Commit 3ccd2f43 authored by Julien Muchembled's avatar Julien Muchembled

Revert [29646] because list setters without List suffix are sometimes called with a list value

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29648 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 58ccd33e
...@@ -99,19 +99,7 @@ class ListSetter(DefaultSetter): ...@@ -99,19 +99,7 @@ class ListSetter(DefaultSetter):
value = map(self._item_cast, value) value = map(self._item_cast, value)
setattr(instance, self._storage_id, tuple(value)) setattr(instance, self._storage_id, tuple(value))
class Setter(DefaultSetter): Setter = ListSetter
def __call__(self, instance, *args, **kw):
value = args[0]
# Modify the property
if value in self._null:
setattr(instance, self._storage_id, ())
elif self._is_tales_type:
setattr(instance, self._storage_id, str(value))
else:
if self._item_cast is not identity:
value = self._item_cast(value)
setattr(instance, self._storage_id, (value,))
class SetSetter(Base.Setter): class SetSetter(Base.Setter):
""" """
......
...@@ -799,8 +799,8 @@ class TestPropertySheet: ...@@ -799,8 +799,8 @@ class TestPropertySheet:
person = module.newContent(portal_type='Person') person = module.newContent(portal_type='Person')
# Do the same tests as in test_11_valueAccessor # Do the same tests as in test_11_valueAccessor
person.setSubject('beta gamma') person.setSubject('beta')
self.assertEquals(person.getSubject(), 'beta gamma') self.assertEquals(person.getSubject(), 'beta')
person.setSubjectList(['alpha', 'alpha']) person.setSubjectList(['alpha', 'alpha'])
self.assertEquals(person.getSubjectList(), ['alpha', 'alpha']) self.assertEquals(person.getSubjectList(), ['alpha', 'alpha'])
self.assertEquals(person.getSubjectSet(), ['alpha']) self.assertEquals(person.getSubjectSet(), ['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