Commit 16c75d2c authored by Arnaud Fontaine's avatar Arnaud Fontaine

ERP5Type: Support for Zope 2.8 has been dropped so set() can now be used without problem.

parent 6c0eae95
......@@ -72,7 +72,7 @@ if spreadsheet_column is None:\n
return \'\'\n
spreadsheet_column_property_list = extract_keyword(spreadsheet_column)\n
for portal_type in module.allowedContentTypes():\n
for property in portal_type.getInstancePropertyAndBaseCategoryList():\n
for property in portal_type.getInstancePropertyAndBaseCategorySet():\n
if property not in forbidden_property:\n
property_dict = {}\n
key = \'%s.%s\' % (portal_type.id, property)\n
......
......@@ -56,7 +56,7 @@ forbidden_property = [\'uid\', \'portal_type\']\n
property_list = []\n
\n
for portal_type in module.allowedContentTypes():\n
for property in portal_type.getInstancePropertyAndBaseCategoryList():\n
for property in portal_type.getInstancePropertyAndBaseCategorySet():\n
if property not in forbidden_property:\n
property_list.append((portal_type.id, property))\n
\n
......
2014-02-19 Arnaud Fontaine
* Support for Zope 2.8 has been dropped so set() can now be used without problem.
2009-04-18 Kazuhiko
* Version 5.4.1
......
412
\ No newline at end of file
413
\ No newline at end of file
......@@ -512,8 +512,8 @@ class ERP5TypeInformation(XMLObject,
return list(self._getPropertyHolder()._categories)
security.declareProtected(Permissions.AccessContentsInformation,
'getInstancePropertyAndBaseCategoryList')
def getInstancePropertyAndBaseCategoryList(self):
'getInstancePropertyAndBaseCategorySet')
def getInstancePropertyAndBaseCategorySet(self):
"""Return all the properties and base categories of the portal type. """
# XXX: Hack until introspection methods are defined. At least, this works
# for portal_type whose properties are defined dynamically
......@@ -530,8 +530,15 @@ class ERP5TypeInformation(XMLObject,
for category in cls._categories:
return_set.add(category)
return_set.add(category + '_free_text')
# XXX Can't return set to restricted code in Zope 2.8.
return list(return_set)
return return_set
security.declareProtected(Permissions.AccessContentsInformation,
'getInstancePropertyAndBaseCategoryList')
@deprecated('getInstancePropertyAndBaseCategoryList is deprecated '
'in favor of getInstancePropertyAndBaseCategorySet')
def getInstancePropertyAndBaseCategoryList(self):
"""Return all the properties and base categories of the portal type"""
return list(self.getInstancePropertyAndBaseCategorySet())
security.declareProtected(Permissions.AccessContentsInformation,
'getInstancePropertyMap')
......
......@@ -167,7 +167,7 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
Properties whose type is 'content' should not be visible in ZMI
so they are not returned by default. This would also slow down
MovementCollectionDiff._getPropertyList (ERP5 product). However,
ERP5TypeInformation.getInstancePropertyAndBaseCategoryList needs them.
ERP5TypeInformation.getInstancePropertyAndBaseCategorySet needs them.
@see Products.ERP5Type.Base.Base._propertyMap
"""
......
......@@ -3088,18 +3088,18 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor):
self.assertEqual(None, person.getProperty('foo_property'))
self.assertEqual(None, person.getProperty('foobar_property'))
def test_getInstancePropertyAndBaseCategoryList(self):
def test_getInstancePropertyAndBaseCategorySet(self):
"""
Check that the method getInstancePropertyAndBaseCategoryList return
Check that the method getInstancePropertyAndBaseCategorySet return
properties from property sheets correctly
"""
portal_type = self.portal.portal_types.Person
result_list = portal_type.getInstancePropertyAndBaseCategoryList()
result_set = portal_type.getInstancePropertyAndBaseCategorySet()
# Test a simple property, an acquired one on and a category.
for x in "id", "address_city", "function":
self.assertTrue(x in result_list, "%s not in %s" % (x, result_list))
self.assertTrue(x in result_set, "%s not in %s" % (x, result_set))
# Values from which acquired properties are fetched are not returned.
self.assertFalse("address" in result_list)
self.assertFalse("address" in result_set)
class TestAccessControl(ERP5TypeTestCase):
......
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