[z3-five] Plone Tool without acquisition

Chris Withers chris at simplistix.co.uk
Thu Feb 8 09:35:35 CET 2007


Philipp von Weitershausen wrote:

> 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).

Really? That feels a bit DWIM :-(

I thought you had to pass in a context to get local utilities?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the z3-five mailing list