[CMF-checkins] CVS: Products/CMFCore - MembershipTool.py:1.49.2.4

Tres Seaver tseaver at palladion.com
Thu Jul 7 14:24:49 EDT 2005


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv8210/CMFCore

Modified Files:
      Tag: CMF-1_5-branch
	MembershipTool.py 
Log Message:


  - CHANGES.txt:  normalize collector URLs.

  - CMFCore/MembershipTool.py:  allow membership tool to search hierarchy
    for user folders which know about a given user ID (collector #354).


=== Products/CMFCore/MembershipTool.py 1.49.2.3 => 1.49.2.4 ===
--- Products/CMFCore/MembershipTool.py:1.49.2.3	Thu Apr  7 12:37:46 2005
+++ Products/CMFCore/MembershipTool.py	Thu Jul  7 14:24:19 2005
@@ -346,10 +346,23 @@
         '''
         Returns the given member.
         '''
-        u = self.acl_users.getUserById(id, None)
-        if u is not None:
-            u = self.wrapUser(u)
-        return u
+        def hauntUser(username,start):
+            """Find user in the hierarchy starting from bottom level 'start'.
+            """
+            uf = start.acl_users
+            while uf is not None:
+                user = uf.getUserById(username)
+                if user:
+                    return user
+                parent = aq_parent(aq_inner(uf))
+                parent = aq_parent(aq_inner(parent))
+                uf = getattr(parent, 'acl_users', None)
+            return None
+
+        user = hauntUser(id, self)
+        if user is not None:
+            user = self.wrapUser(user)
+        return user
 
     def __getPUS(self):
         # Gets something we can call getUsers() and getUserNames() on.



More information about the CMF-checkins mailing list