[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - RoleRegistry.py:1.1.2.3
Tres Seaver
tseaver@zope.com
Thu, 13 Dec 2001 17:47:43 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv26578
Modified Files:
Tag: Zope-3x-branch
RoleRegistry.py
Log Message:
- 'defineRole()' should take keyword arguments, including mandatory
'role' and 'title'.
=== Zope3/lib/python/Zope/App/Security/RoleRegistry.py 1.1.2.2 => 1.1.2.3 ===
return self._prefix + '.' + suffix
- def defineRole(self, name, title=None, description=None):
+ def defineRole(self, role, title, description=None):
"""Define a new role object, register, and return it.
- name is the role name, must be globally unique
+ role is the role name, must be globally unique
- title (optional) is the role title, human readable. If omitted then
- the name is used as the title
+ title is the role title, human readable.
description (optional) is human readable
"""
- if title is None:
- title = name
if description is None:
description = ''
- return self.register(self._make_global_id(name), title, description)
+ return self.register(self._make_global_id(role), title, description)
- def definedRole(self, name):
+ def definedRole(self, role):
"""Return true if named role is registered, otherwise return false
"""
- return self.is_registered(self._make_global_id(name))
+ return self.is_registered(self._make_global_id(role))
- def getRole(self, name):
+ def getRole(self, role):
"""Return role object registered as name.
If no named role is registered KeyError is raised.
"""
- return self.getRegisteredObject(self._make_global_id(name))
+ return self.getRegisteredObject(self._make_global_id(role))
registry = RoleRegistry()