[Zope-CMF] Re: getToolByName depreciation, getUtility, and five.lsm

yuppie y.2007- at wcm-solutions.de
Sun Apr 1 15:07:02 EDT 2007


Hi!


Philipp von Weitershausen wrote:
> Hanno Schlichting wrote:
>> I would say that all of Acquisition is dark implicit magic and something
>> I expect when developing in Zope 2. When using Zope 3 concepts in Zope 2
>> I also expect the need to make the Zope 3 code Acquisition aware. One
>> prime example are browser views, which I need to mix in Acquisition in
>> order for them to work.
> 
> But Products.Five.BrowserView hides that particular detail from you, as 
> much as getToolByName could hide the acquisition detail when looking up 
> tools.
> 
> You're suggesting to introduce yet another package that's destined to go 
> a way at some point, while the same functionality is already available, 
> it only needs to be un-deprecated...

I don't agree. CMF 2.0's getToolByName() requires context object and 
tool name as arguments, the tool has to be a content space object. 
That's quite different to five.lsm's getUtility():

- You can easily replace z2-style tools by z3-style utilities. 
getUtility doesn't care about the implementation, just about the interface.

- You don't have to provide a context object. This makes it easier to 
write new z3-style code.


I prefer the solution proposed by Hanno.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list