Commit 4bd5cbe7 authored by Jérome Perrin's avatar Jérome Perrin

preferences: support multi valuated properties

/reviewed-on nexedi/erp5!852
parent 5709d731
......@@ -74,7 +74,7 @@ def _generatePreferenceToolAccessorHolder(portal_type_name,
attr_list = [ 'get%s' % convertToUpperCase(attribute)]
if prop['type'] == 'boolean':
attr_list.append('is%s' % convertToUpperCase(attribute))
if prop['type'] in list_types :
if prop['type'] in list_types or prop['multivalued']:
attr_list.append('get%sList' % convertToUpperCase(attribute))
read_permission = prop.get('read_permission')
for attribute_name in attr_list:
......
......@@ -578,6 +578,25 @@ class TestPreferences(PropertySheetTestCase):
self.assertTrue(portal_preferences.getDummy())
self.assertTrue(portal_preferences.isDummy())
def test_multivalued_accessor(self):
self._addProperty('Preference',
'test_multivaluated_accessor Preference',
portal_type='Standard Property',
property_id='dummy_multi',
preference=True,
elementary_type='string',
multivalued=True)
portal_preferences = self.portal.portal_preferences
self.assertEqual(None, portal_preferences.getDummyMulti())
preference = portal_preferences.newContent(portal_type='Preference')
preference.setDummyMultiList(['one', 'two'])
preference.enable()
self.tic()
self.assertEqual('one', portal_preferences.getDummyMulti())
self.assertEqual(['one', 'two'], portal_preferences.getDummyMultiList())
def test_property_sheet_security_on_permission(self):
""" Added a test to make sure permissions are used into portal
preference level. """
......
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