From 6436f3f4014074422d468b03c108cad7e170e5bf Mon Sep 17 00:00:00 2001 From: helmutm Date: Wed, 13 Aug 2008 17:36:13 +0000 Subject: [PATCH] bug fix for checking parents git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2807 fd906abe-77d9-0310-91a1-e0d9ade77398 --- security/policy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/security/policy.py b/security/policy.py index 6f58706..998dfee 100644 --- a/security/policy.py +++ b/security/policy.py @@ -64,7 +64,8 @@ class LoopsSecurityPolicy(ZopeSecurityPolicy): for p in self.getParents(obj, checked): # TODO: care for correct combination if there is more than # one parent - roles.update(self.cached_principal_roles(p, principal)) + if p is not None: + roles.update(self.cached_principal_roles(p, principal, checked)) prinrole = IPrincipalRoleMap(obj, None) if prinrole: roles = roles.copy() @@ -76,7 +77,8 @@ class LoopsSecurityPolicy(ZopeSecurityPolicy): def getParents(self, obj, checked): if obj in checked: # cycle - leave the concept map - return [getattr(obj, '__parent__', None)] + parent = getattr(obj, '__parent__', None) + return [parent] # keep concept parents in cache cache = self.cache(obj) try: