[Zope-dev] REQUEST vs. request

Patrick Gerken do3ccqrv at googlemail.com
Tue Jun 16 16:35:32 EDT 2009


Hello,

I am a bit confused about self.request and self.REQUEST.
Can anybody point me to an explanation of the different tasks that both
have?
Googling for request vs REQUEST is not helpful...

Here is the reason why I am wondering:

Context is a small product to be used in plone.

A testcase in my code fails, and after a lot of digging, I am finding that
the reason are wrong results from the catalog. The catalog returns bad
results because he caches the results in the request.
My test consists of a number of steps, for multiple times I do a
getMultiAdapter, always with fresh TestRequests. Still it seems, that the
catalog always use some other, rotten REQUEST.

When stepping through, I see this happening:
1. my BrowserView calls something like self.context.portal_catalog(kw)
    There is no request as an argument
2. The method I call wants that as a positional argument, but has None as
the default value
    That None value gets passed on.
3. In Products.ZCatalog.Catalog:searchResults the code checks whether the
REQUEST
    variable is None, and if so, retrieves self.REQUEST. self.REQUEST ist
the rotten
    REQUEST, self.request would still be available
4. Total chaos is ensured

I can imagine more than one way to fix it, but I don't understand the
difference and reasoning sufficiently to decide, what would be the right(tm)
way to fix it.

Any points will be really appreciated!

Best regards,

      Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-dev/attachments/20090616/846f0ad1/attachment.html 


More information about the Zope-Dev mailing list