[Zope-CVS] CVS: Products/PluggableAuthService/plugins - ZODBGroupManager.py:1.4

Zachery Bir zbir at urbanape.com
Mon Aug 30 11:25:47 EDT 2004


Update of /cvs-repository/Products/PluggableAuthService/plugins
In directory cvs.zope.org:/tmp/cvs-serv18616

Modified Files:
	ZODBGroupManager.py 
Log Message:
Provide for *some* handle on principals that were assigned, but are no
longer found by PAS


=== Products/PluggableAuthService/plugins/ZODBGroupManager.py 1.3 => 1.4 ===
--- Products/PluggableAuthService/plugins/ZODBGroupManager.py:1.3	Thu Aug 12 11:15:54 2004
+++ Products/PluggableAuthService/plugins/ZODBGroupManager.py	Mon Aug 30 11:25:46 2004
@@ -113,11 +113,11 @@
 
                 info = {}
                 info.update( self._groups[ group_id ] )
-                
+
                 info[ 'pluginid' ] = plugin_id
                 info[ 'properties_url' ] = '%s?%s' % ( e_url, p_qs )
                 info[ 'members_url' ] = '%s?%s' % ( e_url, m_qs )
-                
+
                 if not group_filter or group_filter( info ):
                     group_info.append( info )
 
@@ -229,7 +229,7 @@
                 if ( group_id not in self._principal_groups.get( id, () )
                  and group_id != id ):
                     result.append( ( id, title ) )
-        
+
         return result
 
     security.declareProtected( ManageGroups, 'listAssignedPrincipals' )
@@ -245,9 +245,13 @@
 
                 parent = aq_parent( self )
                 info = parent.searchPrincipals( id=k, exact_match=True )
-                assert( len( info ) == 1 )
-                result.append( ( k, info[0].get( 'title', k ) ) )
-        
+                assert( len( info ) in ( 0, 1 ) )
+                if len( info ) == 0:
+                    title = '<%s: not found>' % k
+                else:
+                    title = info[0].get( 'title', k )
+                result.append( ( k, title ) )
+
         return result
 
     security.declareProtected( ManageGroups, 'addPrincipalToGroup' )
@@ -371,7 +375,7 @@
             message = 'no+groups+selected'
 
         else:
-        
+
             for group_id in group_ids:
                 self.removeGroup( group_id )
 
@@ -420,7 +424,7 @@
         """ Remove one or more principals from a group via the ZMI.
         """
         removed = []
-        
+
         for principal_id in principal_ids:
             if self.removePrincipalFromGroup( principal_id, group_id ):
                 removed.append( principal_id )



More information about the Zope-CVS mailing list