[z3-five] Plone Tool without acquisition

Philipp von Weitershausen philipp at weitershausen.de
Thu Feb 8 02:33:16 CET 2007


Dennis Schulz wrote:
>> - The right way to solve your problem would be using a local site 
>> manager. Even if your tools are not registered as utilities, you can 
>> get hold of the site root and therefor of the tool without using 
>> acquisition. Plone 3.0 might give you some hints how to set this up.
> 
> I am not familiar with the Plone 3 code.
> Can anyone point me to an example where  I can see how to set up a local 
> site manager?
> 
> I registered
> 
>  <five:localsite
>          class="Products.CMFPlone.Portal.PloneSite" />
>  
> What is the easiest way to get hold of the site root so I can use the 
> Plone tool without acquisition?

Why would you want to get hold of the site root? Assuming that the CMF 
tools are registered as local utilities, you should simply be able to say:

   from zope.component import getUtility
   from Products.CMFPlone.interfaces import IPloneTool # verify this

   plone_tool = getUtility(IPloneTool)

Zope will automatically figure out that where it should get that tool 
from (because it traversed over the site).

-- 
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5


More information about the z3-five mailing list