diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index 5e89cd29a617481d5de9abcbc32dde94774911d0..47b0b4a6486343ba7eba20d4b7e8893adbf46ec0 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -1259,16 +1259,16 @@ class Base( CopyContainer, # and return it as a list if accessor_name.endswith('List'): mono_valued_accessor_name = accessor_name[:-4] - method = getattr(self, mono_valued_accessor_name, None) + method = getattr(self.__class__, mono_valued_accessor_name, None) if method is not None: # We have a monovalued property if d is _MARKER: - result = method(**kw) + result = method(self, **kw) else: try: - result = method(d, **kw) + result = method(self, d, **kw) except TypeError: - result = method(**kw) + result = method(self, **kw) if not isinstance(result, (list, tuple)): result = [result] return result diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py index cd4f6e41a41472da397a84490ee625f91b2108a9..2ead354a09f9ceba24d4a55b6d2f71fa451a86fe 100644 --- a/product/ERP5Type/tests/testERP5Type.py +++ b/product/ERP5Type/tests/testERP5Type.py @@ -2859,6 +2859,27 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): person.setPropertyList('foo_bar', []) self.assertEquals(person.getFooBarList(), []) + def testPropertyNoAcquisition(self): + """ + Check that getPropertyList (and getProperty as well as + getPropertyList calls getProperty) do not get the property + defined on its parent through acquisition + """ + self._addProperty('Person Module', + 'testPropertyListWithMultivaluedPropertyNoAcquisition', + 'multivalued_no_acquisition', + elementary_type='lines', + portal_type='Standard Property') + + person_module = self.getPersonModule() + person_module.setPropertyList('multivalued_no_acquisition', ['foo']) + self.assertEquals( + person_module.getPropertyList('multivalued_no_acquisition'), ['foo']) + + person = self.getPersonModule().newContent(portal_type='Person') + self.assertEquals( + person.getPropertyList('multivalued_no_acquisition', ['bar']), ['bar']) + def testUndefinedProperties(self): """ Make sure that getProperty and setProperty on a property not defined