@@ -144,7 +144,7 @@ def getPermission(self, permission, classname=None, properties=None,
144144
145145 Raise ValueError if there is no exact match.
146146 '''
147- if not self .permission . has_key ( permission ) :
147+ if permission not in self .permission :
148148 raise ValueError , 'No permission "%s" defined' % permission
149149
150150 if classname :
@@ -187,7 +187,7 @@ def hasPermission(self, permission, userid, classname=None,
187187 if itemid and classname is None :
188188 raise ValueError , 'classname must accompany itemid'
189189 for rolename in self .db .user .get_roles (userid ):
190- if not rolename or not self .role . has_key ( rolename ):
190+ if not rolename or ( rolename not in self .role ):
191191 continue
192192 # for each of the user's Roles, check the permissions
193193 for perm in self .role [rolename ].permissions :
@@ -269,7 +269,7 @@ def hasSearchPermission(self, userid, classname, property):
269269 the list.
270270 '''
271271 roles = [r for r in self .db .user .get_roles (userid )
272- if r and self .role . has_key ( r )]
272+ if r and ( r in self .role )]
273273 return self .roleHasSearchPermission (classname , property , * roles )
274274
275275 def addPermission (self , ** propspec ):
0 commit comments