Le mercredi 22 novembre 2006 à 08:12 +1100, Tom Dossis a écrit :
> Thierry Florac wrote:
> >  - as I use virtual hosting, my utilities are located and registered in
> > a "sub-site". How can I get access to these components in my scheduler
> > tasks throught zapi functions, without knowing "a priori" their names or
> > paths ?
> 
> from zope.app.component import hooks
> hooks.setSite(mysite)
> 
> This should make your utility lookups work.  Of course you still need a
> way to get your subsite 'mysite' object, whether you traverse from the
> root object, etc. is up to you.
> 
> Finally, I'm not sure if you need to setup an interaction, which raises
> the question: what/who is the principal in within your scheduler context?

Many thanks : it seems to work perfectly !
The main solution was to know the "hooks.setSite()" method.
For the rest, I'm just using a ZEO ClientStorage connection to avoid
errors relatives to different database connections, and take a look at
the 'Application' values to find objects implementing a given required
interface (my own site manager interface), and everything is really fine
now...

Thanks again,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

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

Reply via email to