Patrick Gerken wrote:
> I am a bit confused about self.request and self.REQUEST.
> Can anybody point me to an explanation of the different tasks that both
> Googling for request vs REQUEST is not helpful...
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.
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -