[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - LocalSecurityMap.py:1.1.2.7 Registry.py:1.1.2.6 RolePermissionView.py:1.1.2.12 Zope3RoleManagement.py:1.1.2.4 ZopeSecurityPolicy.py:1.1.2.29 _protections.py:1.1.4.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 15:34:53 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv5490/lib/python/Zope/App/Security

Modified Files:
      Tag: Zope-3x-branch
	LocalSecurityMap.py Registry.py RolePermissionView.py 
	Zope3RoleManagement.py ZopeSecurityPolicy.py _protections.py 
Log Message:
Implemented 

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/IContainerPythonification

Along the way:

- Converted most uses of has_key to use in.

- Fixed a bug in Interface names and namesAndDescriptions methods 
  that caused base class attributes to be missed.



=== Zope3/lib/python/Zope/App/Security/LocalSecurityMap.py 1.1.2.6 => 1.1.2.7 ===
     def delCell(self, rowentry, colentry):
         row = self._byrow.get(rowentry)
-        if row and row.has_key(colentry):
+        if row and (colentry in row):
             del self._byrow[rowentry][colentry]
             del self._bycol[colentry][rowentry]
 


=== Zope3/lib/python/Zope/App/Security/Registry.py 1.1.2.5 => 1.1.2.6 ===
         If the id is already registered, an AlreadyRegisteredError is raised.
         """
-        if self._byid.has_key(id):
+        if id in self._byid:
             raise AlreadyRegisteredError('Id is not unique: %s' % id)
         obj = self._class(id, title, description)
         self._byid[id] = obj
@@ -52,7 +52,7 @@
         """Return true if an object is registered with the given id.
         Otherwise false is returned.
         """
-        return self._byid.has_key(id)
+        return id in self._byid
 
     def getRegisteredObject(self, id):
         """Return the object registered under the given id.


=== Zope3/lib/python/Zope/App/Security/RolePermissionView.py 1.1.2.11 => 1.1.2.12 ===
                 rrole = REQUEST.get("r%s" % ir)
                 if rrole not in roles: continue
-                if REQUEST.has_key("p%sr%s" % (ip, ir)):
+                if ("p%sr%s" % (ip, ir))  in REQUEST:
                     prm.grantPermissionToRole(rperm, rrole)
                 else:
                     prm.unsetPermissionFromRole(rperm, rrole)


=== Zope3/lib/python/Zope/App/Security/Zope3RoleManagement.py 1.1.2.3 => 1.1.2.4 ===
         roles = self._getContextBindings()._roles
 
-        if roles.has_key( role_name ):
+        if role_name in roles:
             raise KeyError, 'Role %s already defined.' % role_name
 
         roles[ role_name ] = ()
@@ -70,7 +70,7 @@
         """
         roles = self._getContextBindings()._roles
 
-        if not roles.has_key( role_name ):
+        if not (role_name in roles):
             raise KeyError, 'Role %s not defined.' % role_name
 
         self.clearPermissionsOfRole( role_name )


=== Zope3/lib/python/Zope/App/Security/ZopeSecurityPolicy.py 1.1.2.28 => 1.1.2.29 ===
                 for principal in principals.keys():
                     for role, setting in prm.getRolesForPrincipal(principal):
-                        if not roles.has_key(role):
+                        if not (role in roles):
                             roles[role] = 1
                             if setting is Assign:
                                 assigned_roles[role] = 1
@@ -117,7 +117,7 @@
         global_roles = principalRoleManager.getRolesForPrincipal(principal)
         for principal in principals.keys():
             for role, setting in global_roles:
-                if not roles.has_key(role):
+                if not (role in roles):
                     roles[role] = 1
                     if setting is Assign:
                         assigned_roles[role] = 1


=== Zope3/lib/python/Zope/App/Security/_protections.py 1.1.4.1 => 1.1.4.2 ===
         defineChecker(getattr(module, '%sSet' % which),
                       NamesChecker(['__getitem__', '__len__', 'has_key',
-                                    '__repr__', '__str__',
+                                    '__repr__', '__str__', "__contains__",
                                     'keys', 'maxKey', 'minKey']
                                    )
                       )
         defineChecker(getattr(module, '%sTreeSet' % which),
-                      NamesChecker(['__len__', 'has_key',
+                      NamesChecker(['__len__', 'has_key', "__contains__",
                                    '__repr__', '__str__',
                                    'keys', 'maxKey', 'minKey']
                                    )