Florian Lindner wrote:
I have some local utilites registered. Now I try to call them from a function that don't have a context:

    utils = getUtilitiesFor(INewsfeed)
    for i in utils:
        print "Utility called:", i.__name__

but that always deliver no utilities. How do get them without supplying a context. (the function is called regularly from a scheduler object, therefore it needs to be static)

You need to have traversed over the site that contains the local utilities first, before they can be found. If this function is called outside a request context, use zope.app.component.hooks.setSite(site_obj) to manually set the site.

http://worldcookery.com -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!

Zope3-users mailing list

Reply via email to