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

On 19 Nov 2006, at 18:59, Tres Seaver wrote:
      """Export actions tool.
      """
      site = context.getSite()
- -    tool = getToolByName(site, 'portal_actions', None)
+    tool = getUtility(IActionsTool, context=site)

This looks like it will be the new way of looking up CMF tools? Looks
great.

For the sake of backward compatibility, I'm thinking we should
re-implement 'getToolByName' to use a map of tool name to interface, and
call 'queryUtility' using that interface;  it can then fall back to an
acquired getattr and issue a deprecation warning if that fails (maybe
warn either way?)

Yes, this map is part of the change, including deprecation warning and all. By the way, getToolByName was exposed to untrusted code used in places like skin scripts as well - I suppose for those we need to provide some alternative that is callable from untrusted code.


 But we shouldn't have to specify ``context=site`` should we?
getUtility should automatically figure out what the nearest chain of
sites should be and look for local utilities in each one of them
automatically no?

That won't work unless the tests set up the thread-local site in the
same way that the publisher does.

Right - and that's most likely where I am doing something wrong.

jens


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFFYMGjRAx5nvEhZLIRAuF0AJ4ymVgjQCMw6FlIPSH+iMsxGM1iXACgsCLm
EO3PTIMMIAhRct8OadDt6Dg=
=Eu9u
-----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