[Zope3-Users] Get a site

Florian Lindner mailinglists at xgm.de
Sun Jan 21 08:44:27 EST 2007


Hello,
I am in a function that has no context and want to set a site.
The function is called periodically from a scheduler:

from scheduler import loop

def onStartup(event):
    refresher = loop.LoopTask(releaseRefreshEvent, interval=60)

In this function I need to call getUtilitiesFor which needs a site set but I 
don't know how to get a site:

(Pdb)  from zope.app.component import hooks
(Pdb) from zope.app.zapi import *

(Pdb) hooks.setSite(getSiteManager())
*** AttributeError: 'BaseGlobalComponents' object has no 
attribute 'getSiteManager'

(Pdb) hooks.setSite(getGlobalSiteManager())
*** AttributeError: 'BaseGlobalComponents' object has no 
attribute 'getSiteManager'

Just getting the root object (which AFAIK always is a site) would be ok. Or 
the object of static path.

Thanks,

Florian


More information about the Zope3-users mailing list