[Zope-Checkins] CVS: Zope2 - Owned.py:1.12 SecurityManagement.py:1.4 SecurityManager.py:1.5
evan@serenade.digicool.com
evan@serenade.digicool.com
Mon, 2 Jul 2001 12:29:55 -0400
Update of /cvs-repository/Zope2/lib/python/AccessControl
In directory serenade:/home/evan/Zope/trunk/lib/python/AccessControl
Modified Files:
Owned.py SecurityManagement.py SecurityManager.py
Log Message:
Merged getOwner optimizations from 2.4 branch
--- Updated File Owned.py in package Zope2 --
--- Owned.py 2001/04/27 20:27:37 1.11
+++ Owned.py 2001/07/02 16:29:55 1.12
@@ -135,7 +135,9 @@
getOwner__roles__=()
def getOwner(self, info=0,
- aq_get=aq_get, None=None, UnownableOwner=UnownableOwner,
+ aq_get=aq_get, None=None,
+ UnownableOwner=UnownableOwner,
+ getSecurityManager=getSecurityManager,
):
"""Get the owner
@@ -143,19 +145,25 @@
returned. Otherwise, the owner object is returned.
"""
owner=aq_get(self, '_owner', None, 1)
- if owner is None: return owner
+ if info or (owner is None): return owner
- if info: return owner
-
if owner is UnownableOwner: return None
udb, oid = owner
+ upath = ('',) + tuple(udb) + (oid,)
+ objectCache = getSecurityManager()._context.objectCache
+ if objectCache.has_key(upath):
+ return objectCache[upath]
+
root=self.getPhysicalRoot()
udb=root.unrestrictedTraverse(udb, None)
- if udb is None: return SpecialUsers.nobody
- owner = udb.getUserById(oid, None)
- if owner is None: return SpecialUsers.nobody
- return owner
+ if udb is None:
+ user = SpecialUsers.nobody
+ else:
+ user = udb.getUserById(oid, None)
+ if user is None: user = SpecialUsers.nobody
+ objectCache[upath] = user
+ return user
changeOwnership__roles__=()
def changeOwnership(self, user, recursive=0,
--- Updated File SecurityManagement.py in package Zope2 --
--- SecurityManagement.py 2000/11/10 17:04:14 1.3
+++ SecurityManagement.py 2001/07/02 16:29:55 1.4
@@ -139,6 +139,6 @@
def __init__(self, user):
self.stack=[]
self.user=user
-
+ self.objectCache = {}
--- Updated File SecurityManager.py in package Zope2 --
--- SecurityManager.py 2001/04/11 17:53:22 1.4
+++ SecurityManager.py 2001/07/02 16:29:55 1.5
@@ -214,7 +214,7 @@
self._policy=None
def getUser(self):
- """Gen the current authenticated user"""
+ """Get the current authenticated user"""
return self._context.user
def calledByExecutable(self):