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,7 +310,8 @@ class SetGetter(ListGetter):
def __call__(self, instance, *args, **kw):
result_list = ListGetter.__call__(self, instance, *args, **kw)
result_set = dict([(x, 0) for x in result_list]).keys()
return result_set
if result_list is not None:
result_set = dict([(x, 0) for x in result_list]).keys()
return result_set
Tester = Base.Tester
......@@ -1699,16 +1699,18 @@ class TestPropertySheet:
self.assertTrue(hasattr(person, 'getDummyList'))
self.assertEquals(person.getDummy(), None)
# self.assertEquals(person.getDummyList(), []) # XXX what is the default
# value for a list getter ?
self.assertEquals(person.getDummyList(), None)
self.assertEquals(person.getDummySet(), None)
person.setDummyList(['a', 'b'])
self.assertEquals(person.getDummy(), 'a')
self.assertEquals(person.getDummyList(), ['a', 'b'])
self.assertEquals(person.getDummySet(), ['a', 'b'])
person.setDummy('value')
self.assertEquals(person.getDummy(), '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