[Zope-dev] REQUEST vs. request

Alex Clark aclark at aclark.net
Wed Jun 17 08:38:32 EDT 2009


On 2009-06-17, Martin Aspeli <optilude+lists at gmail.com> wrote:
> REQUEST is a Zope2-ism. When you do self.REQUEST somewhere, you are 
> actually using acquisition to get this object from the outermost item in 
> any (most?) acquisition chain: a magic RequestContainer class whose 
> purpose it is to let you acquire a REQUEST.
>
> In general, this is a bit icky. You probably should avoid it.
>
> self.request is not generally available. Rather, it's the most commonly 
> used name for the request stored on an attribute in a view or viewlet. 
> These are initialised with a context and a request (and view and viewlet 
> manager in the case of a viewlet), and normally store those as 
> self.context and self.request.
>
> In Zope 2, your views *also* support acquisition, because until Zope 
> 2.12 at least, they have to in order to have security. So you can do 
> self.REQUEST on the view, which acquires it from a parent. But this is 
> magic and you shouldn't do it if you can avoid it.

Good explanation, thanks! So in Zope 2.12 we get "z3 style" security?

>
> Martin
>


-- 
Alex Clark · http://aclark.net
Buy Practical Plone 3: http://tinyurl.com/practical-plone



More information about the Zope-Dev mailing list