On 6 Jan 2007, at 23:22 , Martin Aspeli wrote:
Okay, spoke to Philipp on IRC and he asked me to relay his opinions on some of this:

- CMF tools ought not to depend on acquiring things from 'self' if at all possible.

- TTW code will need aq contexts for security. However, it makes sense for getToolBy(Interface)Name() to handle this.

 - Non-TTW code probably shouldn't need aq contexts.

- Registering the portal as a utility that can be obtained by getUtility(IPortalRoot) is pretty good practice; in my estimation, that should solve all the use cases for utilities where acquisition is used now and where we're not really after an adapter, view.

- Using component registries would be bad in terms of maintenance; in my own opinion, aq-wrapping when it may not be needed may lead to headaches later as well.

Also, in my own opinion, why don't we keep getToolByName() (since it's so incredibly prevalent) and just let it handle dotted interface names as well? The chances of a name clash are minute, and we can at a later stage deprecate the non-dotted names. I say this because (a) getToolByInterfaceName() is long :) and (b) it's one more thing to remember and (c) everyone's already using getToolByName().

Actually, why dont you keep a simple mapping between existing names and interfaces, e.g.:

name2iface = {'portal_catalog': ICatalog,
             'portal_skins': ISkinTool,

and use that in getToolByName? Then *all* of the existing code base continues to work, especially if getToolByName does aq wrapping. getToolByName('some.dotted.interface.IName') looks silly.

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

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

Reply via email to