Commit 5b67fd6b authored by Romain Courteaud's avatar Romain Courteaud

Revision 16551 changes the behaviour of parent acquisition.

Acquisition should happen only when parent portal type is defined.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16567 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b805959e
......@@ -781,7 +781,7 @@ class CategoryTool( UniqueObject, Folder, Base ):
#LOG('getSingleCategoryMembershipList', 0, 'base_category = %s, spec = %s, base = %s, context = %s, context.aq_inner.aq_parent = %s' % (repr(base_category), repr(spec), repr(base), repr(context), repr(context.aq_inner.aq_parent)))
if base_category == 'parent':
parent = context.aq_inner.aq_parent # aq_inner is required to make sure we use containment
if not spec or parent.portal_type in spec:
if parent.portal_type in spec:
parent_relative_url = parent.getRelativeUrl()
if (checked_permission is None) or \
(permissionFilter(parent_relative_url) is not None):
......
......@@ -934,26 +934,41 @@ class TestCMFCategory(ERP5TypeTestCase):
obj = self.portal.person_module.newContent(portal_type='Person')
parent_url = self.portal.person_module.getRelativeUrl()
self.assertEquals([parent_url],
self.assertEquals([],
pc.getSingleCategoryMembershipList(obj, 'parent'))
self.assertEquals([parent_url],
pc.getSingleCategoryMembershipList(obj, 'parent',
portal_type='Person Module'))
self.assertEquals([],
pc.getSingleCategoryMembershipList(obj, 'parent',
portal_type='Organisation'))
self.assertEquals(['parent/%s' % parent_url],
self.assertEquals([],
pc.getSingleCategoryMembershipList(obj, 'parent', base=1))
self.assertEquals([parent_url],
self.assertEquals(['parent/%s' % parent_url],
pc.getSingleCategoryMembershipList(obj, 'parent', base=1,
portal_type='Person Module'))
self.assertEquals([],
pc.getSingleCategoryMembershipList(obj, 'parent',
checked_permission='View'))
self.assertEquals([parent_url],
pc.getSingleCategoryMembershipList(obj, 'parent',
checked_permission='View',
portal_type='Person Module'))
noSecurityManager()
self.assertEquals([],
pc.getSingleCategoryMembershipList(obj, 'parent',
checked_permission='Manage portal'))
self.assertEquals([],
pc.getSingleCategoryMembershipList(obj, 'parent',
checked_permission='Manage portal',
portal_type='Person Module'))
def test_suite():
......
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