[Zope3-dev] two local utilities: how?

Roger Ineichen dev at projekt01.ch
Sun Mar 20 10:39:03 EST 2005


Hi Lennart

> -----Original Message-----
> From: zope3-dev-bounces+dev=projekt01.ch at zope.org 
> [mailto:zope3-dev-bounces+dev=projekt01.ch at zope.org] On 
> Behalf Of Lennart Regebro
> Sent: Sunday, March 20, 2005 2:37 PM
> To: zope3-dev at zope.org
> Subject: [Zope3-dev] two local utilities: how?
> 
> I need to have two local utilites where one of them needs to use the 
> other one. I'm completely lost here, and have no idea even when to 
> start. I'm still in unit-test-level, and need to firstly register the 
> local utilities properly in setUp(), and then I nexed to make 
> getUtility 
> work so one utility can call the other.
> 
> Does anybody have an example of this beong done?

Check this out:

- Make sure the utilities are registred correctly.

- Check if the utilities has a correct location
  You can use zapi.getPath(utility)
  Perhaps one utility is registred on a global service,
  and one utility is registred in a local site?

Call a utility from another utility with getUtility(..., context=self). 
Where context="self" is the utility from where you call the other utility

This should work!

Otherwise post the unittest code here.

Regards
Roger Ineichen

> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub: 
> http://mail.zope.org/mailman/options/zope3-dev/dev%40projekt01.ch
> 
> 



More information about the Zope3-dev mailing list