annotations(principal, context=None)
adapt principal to annotations via principal annotation utility.
To illustrate, we'll register the adapter and a dummy principal annotation utility.
>>> component.provideAdapter(annotations) >>> class DummyPrincipal(object): ... interface.implements(zope.security.interfaces.IPrincipal) ... def __init__(self, id, title=None, description=None): ... self.id = id ... self.title = title ... self.description = description ... >>> dummy_annotation = {} >>> class DummyPAU(object): ... interface.implements(interfaces.IPrincipalAnnotationUtility) ... def getAnnotations(self, principal): ... if principal.id == 'sue': ... return dummy_annotation ... raise NotImplementedError ... >>> pau = DummyPAU() >>> component.provideUtility(pau) >>> sue = DummyPrincipal('sue') >>> annotation = IAnnotations(sue) >>> annotation is dummy_annotation True
__implemented__
(type:
_Proxy
)
<implementedBy ?>
__component_adapts__
(type:
_Proxy
)
(<InterfaceClass zope.security.interfaces.IPrincipal>,)