[Checkins] SVN: PluggableAuthService/trunk/plugins/ZODBRoleManager.py - Fixed bug in manage_afterAdd where it would blow up with a KeyError if called twice. This would happen if the conatiner was copied/pasted and was happening in Five when setup via an event.

Andrew Sawyers andrew at sawdog.com
Wed Aug 30 11:41:07 EDT 2006


Log message for revision 69891:
  - Fixed bug in manage_afterAdd where it would blow up with a KeyError if called twice.  This would happen if the conatiner was copied/pasted and was happening in Five when setup via an event.
  

Changed:
  U   PluggableAuthService/trunk/plugins/ZODBRoleManager.py

-=-
Modified: PluggableAuthService/trunk/plugins/ZODBRoleManager.py
===================================================================
--- PluggableAuthService/trunk/plugins/ZODBRoleManager.py	2006-08-30 15:38:37 UTC (rev 69890)
+++ PluggableAuthService/trunk/plugins/ZODBRoleManager.py	2006-08-30 15:41:06 UTC (rev 69891)
@@ -73,8 +73,6 @@
 
     def manage_afterAdd( self, item, container ):
 
-        self.addRole( 'Manager' )
-
         if item is self:
             role_holder = aq_parent( aq_inner( container ) )
             for role in getattr( role_holder, '__ac_roles__', () ):
@@ -84,6 +82,9 @@
                 except KeyError:
                     pass
 
+        if 'Manager' not in self._roles:
+            self.addRole( 'Manager' )
+
     #
     #   IRolesPlugin implementation
     #



More information about the Checkins mailing list