Shane Hathaway wrote:
Alternatively, it may possible to setup an adapter for
IInternalPrincipal to IPrincipal ?
I tried that first, but it got messy. IPrincipal needs an id, but
InternalPrincipal doesn't know its own id; only the folder that contains
it knows. However, the folder has no method for giving me the id of an
InternalPrincipal, so the encapsulation isn't complete. Maybe I should
work harder in this direction anyway.
zapi.getName(principal) will get the id managed by principal folder, e.g.
>>> sm = site.getSiteManager()
>>> pf = sm['tools']['PluggableAuthentication']['PrincipalFolder']
<zope.app.authentication.principalfolder.PrincipalFolder object at
>>> principal = pf['1']
<zope.app.authentication.principalfolder.InternalPrincipal object at
>>> from zope.app import zapi
Your idea of annotating InternalPrincipals rather than Principals seems
to work, but I apparently did something wrong, because edited
annotations don't persist! I can save edits, but when I reload the
page, they're gone. I don't know why.
I seem to recall encountering a similar problem once before, but
unfortunately can't remember the details. I do remember looking at the
annotation code to work it out.
Thanks for helping me over a hurdle. You'd think a Zope 2 veteran like
me would have little trouble with Zope 3
Maybe that has something to do with it.
We switched from zope2/cmf/plone to zope3 early on in the development of
a new application. Interestingly the python-only programmer back then
took to zope3 much easier than zope2/cmf/plone.
get to know practically all of Zope 3 before I can really do anything
with it. (I had to do the same thing with Zope 2.)
I'm sure it will all click into place soon enough.
Zope3-users mailing list