[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - RolePermissionView.py:1.1.2.8

Steve Alexander steve@cat-box.net
Fri, 15 Feb 2002 14:49:45 -0500


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

Modified Files:
      Tag: Zope-3x-branch
	RolePermissionView.py 
Log Message:
Changed 'Allow' and 'Assign' to symbolic constants from Security/Settings.py



=== Zope3/lib/python/Zope/App/Security/RolePermissionView.py 1.1.2.7 => 1.1.2.8 ===
 from Zope.App.Security.IPermission import IPermission
 from Zope.App.Security.IRole import IRole
+from Zope.App.Security.Settings import Allow, Assign
 
 class RolePermissionView(AttributePublisher, ContextDependent):
 
@@ -139,14 +140,14 @@
     def roles(self):
         prm = getAdapter(self._context, IRolePermissionManager)
         proles = prm.getRolesForPermission(self._permission.getId())
-        proles = [role for role,directive in proles if directive=='Allow']        
+        proles = [role for role,setting in proles if setting==Allow]
         return [((role.getId() in proles) and '1' or None)
                 for role in self._roles]
         
     def rolesInfo(self):
         prm = getAdapter(self._context, IRolePermissionManager)
         proles = prm.getRolesForPermission(self._permission.getId())
-        proles = [role for role,directive in proles if directive=='Allow']
+        proles = [role for role,setting in proles if setting==Allow]
         return [{'id': role.getId(),
                  'title': role.getTitle(),
                  'checked': ((role.getId() in proles) and '1' or None)}
@@ -174,8 +175,8 @@
         prm = getAdapter(self._context, IRolePermissionManager)
         rperms = prm.getPermissionsForRole(self._role.getId())
         rperms = [permission
-                  for permission,directive in rperms
-                  if directive=='Allow']
+                  for permission,setting in rperms
+                  if setting==Allow]
         return [{'id': permission.getId(),
                  'title': permission.getTitle(),
                  'checked': ((permission.getId() in rperms) and '1' or None)}