[Zope-Checkins] CVS: Zope/lib/python/AccessControl - Owned.py:1.15.10.4

Shane Hathaway shane@cvs.zope.org
Mon, 26 Aug 2002 09:43:27 -0400


Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv30678/lib/python/AccessControl

Modified Files:
      Tag: Zope-2_5-branch
	Owned.py 
Log Message:
Backported the testCopySupport fix from the head to the 2_5 branch.
When identifying the owner of an object, Owned.py assumed it could store
the "id" attribute of a user folder, when in reality that attribute may
be a method of the class.  Work around this by calling id if it is callable.


=== Zope/lib/python/AccessControl/Owned.py 1.15.10.3 => 1.15.10.4 ===
--- Zope/lib/python/AccessControl/Owned.py:1.15.10.3	Fri Mar  8 11:06:12 2002
+++ Zope/lib/python/AccessControl/Owned.py	Mon Aug 26 09:43:26 2002
@@ -231,7 +231,11 @@
 
 class EditUnowned(Exception):
     "Can't edit unowned executables"
-        
+
+
+def absattr(attr):
+    if callable(attr): return attr()
+    return attr
 
 def ownerInfo(user,
               getattr=getattr, type=type, st=type(''), None=None):
@@ -240,7 +244,7 @@
     uid=user.getId()
     if uid is None: return uid
     db=user.aq_inner.aq_parent
-    path=[db.id]
+    path=[absattr(db.id)]
     root=db.getPhysicalRoot()
     while 1:
         db=getattr(db,'aq_inner', None)