[Zope-CMF] Re: [CMF 2.1] FSPageTemplate & Unicode

Martin Aspeli optilude at gmx.net
Sun Jan 7 18:40:51 EST 2007


Jens Vagelpohl wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> On 7 Jan 2007, at 23:45, Martin Aspeli wrote:
>> A warning is of course one thing. If getToolByName() is gone  
>> entirely in a year (I don't know if that was your intention or not)  
>> it's pretty scary. Surely, some things deserve longer deprecation  
>> periods than others, and getToolByName() is used in pretty much  
>> every third party product (certainly every one I've written).
> 
> If that is your main concern then let me put it to rest right now.  
> getToolByName is very central, we all know that. It won't just be  
> ripped out without some kind of consultation. I just want to scare  
> people enough so they switch their code sooner rather than later.

:)

> Let's talk about something fun instead, like that wrapping issue. I  
> personally can't see any problem with Hanno's suggestion for a  
> "special" component registry and automatically wrapping those tools  
> that are in the little registry. I'm just concerned that this  
> registry is being abused a little - it really was only meant for  
> getToolByName to construct a more meaningful deprecation message  
> where the interface name is displayed, looked up from the tool ID. It  
> seems Hanno's suggestion forces it to be kept around even after  
> getToolByName has gone away in the distant future.

Why not do it a more Zope3 ish way:

class ICMFTool(Interface):
    """Marker for any CMF tool"""

and then in the subclass of the local component registry:

local_utility = ....
if ICMFTool.providedBy(local_utility):
     local_utility = local_utility.__of__(context)

or so. We could mix ICMFTool into the interface hierarchy for CMF's 
tools, or declare it explicitly on each interface. We could even be more 
specific, and call it IAcquisitionDependentTool and only use it where aq 
is truly needed.

Martin



More information about the Zope-CMF mailing list