Andreas Elvers wrote:
Hi,

I looked a bit deeper and found that zapi.principals().getPrincipal does
not know about principals defined in a local site. It will only return principals defined in zcml. zapi.principals().getPrincipal is used in groupfolder.py in line 261 for Zope 3.2.0 and magically finds the right principal when a principal is added to a group through ZMI. But when I try to do:

mygroup.principals = ('pauprefix.principalprefix.principalid') it is simply not working. There must be some kind of hidden context. I think I'm missing a big link in the Zope3 puzzle. Can someone elaborate please ?

Thanks
- Andreas

Hi,

Zope3 stores the current site in a tread-global variable, so if you want to change this context, you have to set a hook like this:


try:
    old_site = zope.app.component.hooks.getSite()
    zope.app.component.hooks.setSite(root_folder)

    # do the pau things

finally:
    zope.app.component.hooks.setSite(old_site)


Where root_folder is the object providing ISite (the site containing your PAU).


HTH
--
Michael Howitz

gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to