Commit c1c25a7c authored by Jérome Perrin's avatar Jérome Perrin

Clarify the case of list/set accessors when no value is defined: they return None.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17861 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0d4af1ad
...@@ -310,6 +310,7 @@ class SetGetter(ListGetter): ...@@ -310,6 +310,7 @@ class SetGetter(ListGetter):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
result_list = ListGetter.__call__(self, instance, *args, **kw) result_list = ListGetter.__call__(self, instance, *args, **kw)
if result_list is not None:
result_set = dict([(x, 0) for x in result_list]).keys() result_set = dict([(x, 0) for x in result_list]).keys()
return result_set return result_set
......
...@@ -1699,16 +1699,18 @@ class TestPropertySheet: ...@@ -1699,16 +1699,18 @@ class TestPropertySheet:
self.assertTrue(hasattr(person, 'getDummyList')) self.assertTrue(hasattr(person, 'getDummyList'))
self.assertEquals(person.getDummy(), None) self.assertEquals(person.getDummy(), None)
# self.assertEquals(person.getDummyList(), []) # XXX what is the default self.assertEquals(person.getDummyList(), None)
# value for a list getter ? self.assertEquals(person.getDummySet(), None)
person.setDummyList(['a', 'b']) person.setDummyList(['a', 'b'])
self.assertEquals(person.getDummy(), 'a') self.assertEquals(person.getDummy(), 'a')
self.assertEquals(person.getDummyList(), ['a', 'b']) self.assertEquals(person.getDummyList(), ['a', 'b'])
self.assertEquals(person.getDummySet(), ['a', 'b'])
person.setDummy('value') person.setDummy('value')
self.assertEquals(person.getDummy(), 'value') self.assertEquals(person.getDummy(), 'value')
self.assertEquals(person.getDummyList(), ['value']) self.assertEquals(person.getDummyList(), ['value'])
self.assertEquals(person.getDummySet(), ['value'])
......
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