Am Mittwoch, 10. Januar 2007 22:14 schrieb Tom Dossis:
> Florian Lindner wrote:
> > Hello,
> > 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__
> >         i.sendNotification()
> >
> > 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)
>
> I'm not sure what a 'scheduler object' is, 

It's in the zope3 trunk.

> but it sounds like you don't 
> have you don't have a current site.
>
> You can confirm this with:
>
>   from zope.app.component import hooks
>   print hooks.getSite()
>   # None

That is what happens.

> Use:
>   # work out what your site
>   hook.set(site)

Mhh, the hook object does not exist, hooks does not have a attribute set. What 
object do you refer to?

>
> before your util lookups.

Thanks,

Florian
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to