Function
zope.securitypolicy.role.setIdOnActivation

Signature

setIdOnActivation(role, event)

Documentation String

Set the permission id upon registration activation.

Let's see how this notifier can be used. First we need to create an event using the permission instance and a registration stub:

>>> class Registration:
...     def __init__(self, obj, name):
...         self.component = obj
...         self.name = name
>>> role1 = LocalRole('Role 1', 'A first role')
>>> role1.id
u'<role not activated>'
>>> import zope.component.interfaces
>>> event = zope.component.interfaces.Registered(
...     Registration(role1, 'role1'))

Now we pass the event into this function, and the id of the role should be set to 'role1'.

>>> setIdOnActivation(role1, event)
>>> role1.id
'role1'