[Zope-dev] zope.globalrequest?

Dieter Maurer dieter at handshake.de
Sun Jan 18 02:20:16 EST 2009


Martin Aspeli wrote at 2009-1-17 11:36 +0000:
>Dieter Maurer wrote:
>> Christian Theune wrote at 2009-1-16 09:06 +0100:
>>> I noticed 'zope.globalrequest' on the PyPI RSS feed today and wonder
>>> about it. IMHO this implements an anti-pattern in an official way
>>> without a warning that this needs to be handled with care.
>> 
>> IMHO, it is not an anti-pattern:
>> 
>>    We have a global "site" why should we not have a global request?
>> 
>>    When Zope is used as a Web Application Server, it is quite
>>    natural to expect a request.
>
>+1
>
>However, there is a definite risk with it as well of encouraging poor 
>separation of concerns. If code is dependent on a request it's not 
>re-usable outside the web container. For views or web app controllers, 
>that's certainly fine, but if you're writing something more generic, 
>then it may be better to have the discipline to pass objects around that 
>properly abstract your data, rather than assume you can access the 
>request willy-nilly.

We are in Python land -- and accustomed that using our freedoms
occationally has a price :-)



-- 
Dieter


More information about the Zope-Dev mailing list