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

Brian Lloyd brian at zope.com
Thu Jan 29 14:31:01 EST 2004


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

Modified Files:
      Tag: Zope-2_7-branch
	Owned.py 
Log Message:
fix inadvertant getOwner result change


=== Zope/lib/python/AccessControl/Owned.py 1.19.46.1 => 1.19.46.2 ===
--- Zope/lib/python/AccessControl/Owned.py:1.19.46.1	Tue Jan 27 11:24:32 2004
+++ Zope/lib/python/AccessControl/Owned.py	Thu Jan 29 14:30:59 2004
@@ -62,7 +62,11 @@
         return d
 
     getOwner__roles__=()
-    def getOwner(self, info=0):
+    def getOwner(self, info=0,
+                 aq_get=aq_get, None=None,
+                 UnownableOwner=UnownableOwner,
+                 getSecurityManager=getSecurityManager,
+                 ):
         """Get the owner
 
         If a true argument is provided, then only the owner path and id are
@@ -74,9 +78,22 @@
                           'please use getOwnerTuple() instead.',
                           DeprecationWarning)
 
-            return self.getOwnerTuple()
 
-        return aq_base(self.getWrappedOwner()) # ugh, backward compat.
+        owner=aq_get(self, '_owner', None, 1)
+        if info or (owner is None): return owner
+
+        if owner is UnownableOwner: return None
+
+        udb, oid = owner
+
+        root=self.getPhysicalRoot()
+        udb=root.unrestrictedTraverse(udb, None)
+        if udb is None:
+            user = SpecialUsers.nobody
+        else:
+            user = udb.getUserById(oid, None)
+            if user is None: user = SpecialUsers.nobody
+        return user
 
     getOwnerTuple__roles__=()
     def getOwnerTuple(self):




More information about the Zope-Checkins mailing list