[Zope3-dev] Principal with annotations

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Sep 25 14:41:00 EDT 2004


On Saturday 25 September 2004 14:32, Florian Lindner wrote:
>     def __init__(self, principal):
>         annotationsvc = zapi.getService('PrincipalAnnotation')
>         annotations = annotationsvc.getAnnotations(principal)
>         if annotations.get(key) is None:
>             annotations[key] = PersistentDict()
>             self.info = annotations[key]

You did not copy the example correctly. You have an indentation error. The 
line

             self.info = annotations[key]

must be outside the "if" statement, so that the info attribute is always 
available.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list