-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rocky Burt wrote:
> 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.

+1 here, too.  In fact, being able to make this switch is the *reason*
'getToolByName' was introduced in the first placey.

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

I think we are likely to modify 'getToolByName' to use a registry of
names to utility interfaces for all the "known" names, falling back to
getattr only for unknown ones.  In that case, the deprecation message
can supply either the name of the interface, or at least say that the
name is not a "known" tool name.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFBBxJ+gerLs4ltQ4RAr6/AKCyhPoKGODtwUg5rVdo639YfbTeWACfcIt3
pZw9Eewu+EWXMhLvPKbajAg=
=K23L
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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

Reply via email to