setIdOnActivation(permission, event)
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
>>> perm1 = LocalPermission('Permission 1', 'A first permission') >>> perm1.id u'<permission not activated>'
>>> import zope.component.interfaces >>> event = zope.component.interfaces.Registered( ... Registration(perm1, 'perm1'))
Now we pass the event into this function, and the id of the permission should be set to 'perm1'.
>>> setIdOnActivation(perm1, event) >>> perm1.id 'perm1'