[Zope-Checkins]
SVN: Zope/branches/philikon-aq/lib/python/AccessControl/
Use either obj.__parent__or aq_parent(obj) instead of obj.aq_parent.
Philipp von Weitershausen
philikon at philikon.de
Fri Jul 27 19:43:28 EDT 2007
Log message for revision 78401:
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.
Changed:
U Zope/branches/philikon-aq/lib/python/AccessControl/ImplPython.py
U Zope/branches/philikon-aq/lib/python/AccessControl/Owned.py
U Zope/branches/philikon-aq/lib/python/AccessControl/PermissionMapping.py
U Zope/branches/philikon-aq/lib/python/AccessControl/Role.py
U Zope/branches/philikon-aq/lib/python/AccessControl/User.py
-=-
Modified: Zope/branches/philikon-aq/lib/python/AccessControl/ImplPython.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/AccessControl/ImplPython.py 2007-07-27 23:41:03 UTC (rev 78400)
+++ Zope/branches/philikon-aq/lib/python/AccessControl/ImplPython.py 2007-07-27 23:43:27 UTC (rev 78401)
@@ -101,7 +101,7 @@
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:
Modified: Zope/branches/philikon-aq/lib/python/AccessControl/Owned.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/AccessControl/Owned.py 2007-07-27 23:41:03 UTC (rev 78400)
+++ Zope/branches/philikon-aq/lib/python/AccessControl/Owned.py 2007-07-27 23:43:27 UTC (rev 78401)
@@ -21,7 +21,7 @@
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 @@
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 @@
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):
Modified: Zope/branches/philikon-aq/lib/python/AccessControl/PermissionMapping.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/AccessControl/PermissionMapping.py 2007-07-27 23:41:03 UTC (rev 78400)
+++ Zope/branches/philikon-aq/lib/python/AccessControl/PermissionMapping.py 2007-07-27 23:43:27 UTC (rev 78401)
@@ -105,7 +105,7 @@
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
Modified: Zope/branches/philikon-aq/lib/python/AccessControl/Role.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/AccessControl/Role.py 2007-07-27 23:41:03 UTC (rev 78400)
+++ Zope/branches/philikon-aq/lib/python/AccessControl/Role.py 2007-07-27 23:43:27 UTC (rev 78401)
@@ -188,7 +188,7 @@
if userObj:
break
else:
- current = current.aq_parent
+ current = current.__parent__
newSecurityManager(None, userObj) # necessary?
@@ -414,7 +414,7 @@
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 @@
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()
Modified: Zope/branches/philikon-aq/lib/python/AccessControl/User.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/AccessControl/User.py 2007-07-27 23:41:03 UTC (rev 78400)
+++ Zope/branches/philikon-aq/lib/python/AccessControl/User.py 2007-07-27 23:43:27 UTC (rev 78401)
@@ -106,7 +106,7 @@
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 @@
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 @@
# 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 @@
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 @@
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 @@
# 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 @@
def _isTop(self):
try:
- return self.aq_parent.aq_base.isTopLevelPrincipiaApplicationObject
+ return self.__parent__.aq_base.isTopLevelPrincipiaApplicationObject
except:
return 0
More information about the Zope-Checkins
mailing list