[Zope-dev] zope.globalrequest?

Martin Aspeli optilude+lists at gmail.com
Sat Jan 17 06:36:55 EST 2009


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.

This is a documentation issue, though.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope-Dev mailing list