Use either obj.__parent__or aq_parent(obj) instead of obj.aq_parent.

Both are the canonical forms of getting to an object's parent now.
parent 9ba2c98f
......@@ -101,7 +101,7 @@ def rolesForPermissionOn(perm, object, default=_default_roles, n=None):
object = getattr(object, 'aq_inner', None)
if object is None:
break
object = object.aq_parent
object = object.__parent__
if r is None:
if _embed_permission_in_roles:
......
......@@ -21,7 +21,7 @@ from AccessControl import ClassSecurityInfo
from AccessControl import getSecurityManager, Unauthorized
from AccessControl.Permissions import view_management_screens
from AccessControl.Permissions import take_ownership
from Acquisition import aq_get, aq_parent, aq_base
from Acquisition import aq_get, aq_parent, aq_base, aq_inner
from requestmethod import requestmethod
from zope.interface import implements
......@@ -236,12 +236,12 @@ class Owned(ExtensionClass.Base):
def manage_fixupOwnershipAfterAdd(self):
# Sigh, get the parent's _owner
parent=getattr(self, 'aq_parent', None)
parent=getattr(self, '__parent__', None)
if parent is not None: _owner=aq_get(parent, '_owner', None, 1)
else: _owner=None
if (_owner is None and
((not hasattr(self, 'aq_parent')) or
((not getattr(self, '__parent__', None) is None) or
(not hasattr(self, 'getPhysicalRoot'))
)
):
......@@ -298,13 +298,13 @@ def ownerInfo(user, getattr=getattr):
return None
uid=user.getId()
if uid is None: return uid
db=user.aq_inner.aq_parent
db=aq_parent(aq_inner(user))
path=[absattr(db.id)]
root=db.getPhysicalRoot()
while 1:
db=getattr(db,'aq_inner', None)
if db is None: break
db=db.aq_parent
db=aq_parent(db)
if db is root: break
id=db.id
if not isinstance(id, str):
......
......@@ -105,7 +105,7 @@ class RoleManager:
return r
def _isBeingAccessedAsZClassDefinedInstanceMethod(self):
p=getattr(self,'aq_parent',None)
p=getattr(self,'__parent__',None)
if p is None: return 0 # Not wrapped
base=getattr(p, 'aq_base', None)
return type(base) is PermissionMapper
......
......@@ -188,7 +188,7 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
if userObj:
break
else:
current = current.aq_parent
current = current.__parent__
newSecurityManager(None, userObj) # necessary?
......@@ -414,7 +414,7 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
raise OverflowError
for name in unl:
dict[name]=1
item = getattr(item, 'aq_parent', _notfound)
item = getattr(item, '__parent__', _notfound)
if item is _notfound:
break
keys=dict.keys()
......@@ -511,9 +511,9 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
for role in roles:
if not dup(role):
dict[role]=1
if not hasattr(obj, 'aq_parent'):
if getattr(obj, '__parent__', None) is None:
break
obj=obj.aq_parent
obj=obj.__parent__
x=x+1
roles=dict.keys()
roles.sort()
......
......@@ -106,7 +106,7 @@ class BasicUser(Implicit):
for r in dict.get(userid, []):
local[r]=1
inner = getattr(object, 'aq_inner', object)
parent = getattr(inner, 'aq_parent', None)
parent = getattr(inner, '__parent__', None)
if parent is not None:
object = parent
continue
......@@ -148,10 +148,10 @@ class BasicUser(Implicit):
else:
try: return r+list(roles)
except: return r
if hasattr(parent, 'aq_parent'):
if getattr(parent, '__parent__', None) is not None:
while hasattr(parent.aq_self,'aq_self'):
parent=parent.aq_self
parent=parent.aq_parent
parent = parent.aq_self
parent = parent.__parent__
else: return r
def _check_context(self, object):
......@@ -160,8 +160,8 @@ class BasicUser(Implicit):
# to prevent "stealing" access through acquisition tricks.
# Return true if in context, false if not or if context
# cannot be determined (object is not wrapped).
parent = getattr(self, 'aq_parent', None)
context = getattr(parent, 'aq_parent', None)
parent = getattr(self, '__parent__', None)
context = getattr(parent, '__parent__', None)
if context is not None:
if object is None:
return 1
......@@ -230,7 +230,7 @@ class BasicUser(Implicit):
return 1
return 0
inner = getattr(inner_obj, 'aq_inner', inner_obj)
parent = getattr(inner, 'aq_parent', None)
parent = getattr(inner, '__parent__', None)
if parent is not None:
inner_obj = parent
continue
......@@ -751,11 +751,11 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
request.RESPONSE.notFoundError('no default view (root default view'
' was probably deleted)')
n = request.steps[-1]
# default to accessed and container as v.aq_parent
# default to accessed and container as v.__parent__
a = c = request['PARENTS'][0]
# try to find actual container
inner = getattr(v, 'aq_inner', v)
innerparent = getattr(inner, 'aq_parent', None)
innerparent = getattr(inner, '__parent__', None)
if innerparent is not None:
# this is not a method, we needn't treat it specially
c = innerparent
......@@ -763,8 +763,8 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
# this is a method, we need to treat it specially
c = v.im_self
c = getattr(v, 'aq_inner', v)
request_container = getattr(request['PARENTS'][-1], 'aq_parent', [])
# if pub's aq_parent or container is the request container, it
request_container = getattr(request['PARENTS'][-1], '__parent__', [])
# if pub's __parent__ or container is the request container, it
# means pub was accessed from the root
if a is request_container:
a = request['PARENTS'][-1]
......@@ -775,7 +775,7 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
def _isTop(self):
try:
return self.aq_parent.aq_base.isTopLevelPrincipiaApplicationObject
return self.__parent__.aq_base.isTopLevelPrincipiaApplicationObject
except:
return 0
......
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