On Sat, 2006-09-09 at 21:57 +0100, Martin Aspeli wrote:
> 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.

+10 on this idea from me.  The important thing would be to make sure the
getToolByName deprecation message is smart enough to describe the exact
necessary getUtility call.  In other words use "getToolByName(context,
'portal_properties') has been deprecated, please use
getUtility(IPropertiesTool) instead" rather than the confusing
"getToolByName has been deprecated, please use getUtility instead".

- Rocky

Rocky Burt
ServerZen Software -- http://www.serverzen.com
News About The Server (blog) -- http://www.serverzen.net

Attachment: signature.asc
Description: This is a digitally signed message part

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

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

Reply via email to