Hi guys,

philiKON pointed out something interesting to me the other day - we could actually register the existing tools as local utilities as of Zope 2.10. That way, you could do this:

  actions = getUtility(IActionsTool)

as another spelling for

  actions = getToolByName(context, 'portal_actions')

But now we're being more consistent with Zope 3, we are using a proper interface and not just a string to check, we don't have to worry about passing a context parameter (though tests have to do a setSite() call), and we can let the registration be overridden with the component registry operations.

Note that I'm not saying we move the tools out of ${site_root}/portal_actions or whatever - they can still live there in the ZODB. You just reference them in the registerUtility() call.

For this to happen, we'd need to:

- Make the site root into an actual site (Plone already does this, it's only two lines of code)

- Do the appropriate registrations of the utilities. We could probably do this in the handler for toolset.xml. GSLocalAddOn already has the GS code to talk to the site manager.

- Make sure that tests made a call to setSite(self.portal) in afterSetUp or similar if they wanted to use the getUtility() syntax. Of course, this won't affect tests or other code that still uses the getToolByName() syntax.

All in all, it's probably zero negative impact and a nice step towards Zope 3, in that we could deprecate getToolByName() in some distant future in favour of more Zope3-style lookup.


Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to