[Zope-CMF] [dev] tools as utilities

yuppie y.2012 at wcm-solutions.de
Thu Sep 6 06:14:48 UTC 2012


Hi Laurence!


Laurence Rowe wrote:
> On 5 September 2012 19:21, Laurence Rowe <l at lrowe.co.uk> wrote:
>> Instead of removing the RequestContainer, it could be replaced with a
>> zope.globalrequest aware RequestContainer. That might be cleaner than
>> rewrapping in individual utilities, and would work with Zope 2.13.
>
> I gave this a go in
> http://zope3.pov.lt/trac/changeset/127722/five.localsitemanager/branches/global-request-container
>
> It seems to work fine with the CMF trunk tests even when I remove all
> RequestContainer wrapping from both CMFCore and CMFDefault (the
> CMFDefault tests then fail with five.localsitemanage trunk.)
>
> http://zope3.pov.lt/trac/changeset/127724/Products.CMFCore/branches/global-request-container
> http://zope3.pov.lt/trac/changeset/127726/Products.CMFDefault/branches/global-request-container

Nice!

Unfortunately there's a trade-off:

Modernizing the RequestContainer concept makes it possible to move 
forward in some areas without breaking existing code. That's a good thing.

But on the other hand it makes it easy to write bad code. New code 
should not rely on this. People should write views if their code depends 
on the request, not utilities.

I think this discussion is closely related to your plans for Zope 4: If 
Zope 4 will (re-)enable the get-request-by-acquisition pattern 
everywhere, it doesn't make much sense to be more restrictive in CMF 2.3 
on Zope 2.13.

Please consider providing tools for people who want to write clean code. 
Documentation, warnings, maybe even a switch for disabling the legacy 
behavior.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list