[Zope-CVS] CVS: Products/PluggableAuthService/plugins - ZODBRoleManager.py:1.3.4.1

Lennart Regebro regebro at nuxeo.com
Mon Aug 30 13:11:35 EDT 2004


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

Modified Files:
      Tag: regebro-implement_challenge-branch
	ZODBRoleManager.py 
Log Message:
Fixed a bug that breaks the role manager if a user with roles is deleted.


=== Products/PluggableAuthService/plugins/ZODBRoleManager.py 1.3 => 1.3.4.1 ===
--- Products/PluggableAuthService/plugins/ZODBRoleManager.py:1.3	Thu Aug 12 11:15:54 2004
+++ Products/PluggableAuthService/plugins/ZODBRoleManager.py	Mon Aug 30 13:11:35 2004
@@ -256,8 +256,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 ) ) )
+                # This assertion used to be == 1. However, if a user
+                # is deleted, this would break the whole plugin.
+                # So that can't be right. Now checking that is is
+                # instead less than two.
+                assert( len( info ) < 2 )
+                if info:
+                    result.append( ( k, info[0].get( 'title', k ) ) )
         
         return result
 



More information about the Zope-CVS mailing list