[Zope] REQUEST not accessible

Jürgen Herrmann Juergen.Herrmann at XLhost.de
Thu Oct 13 06:56:02 EDT 2005


[ Jens Vagelpohl wrote:]
>
> On 13 Oct 2005, at 11:39, Jürgen Herrmann wrote:
>> up to some time in them i could just write:
>> tal:define="results python:here.Catalog.searchResults()"
>>
>> it seems this isn't working anymore, the catalog would return
>> all brains instead of seraching the relevant ones... (completely
>> ignoreing everything in REQUEST)
>>
>> instead i have to write now:
>> tal:define="results python:here.Catalog.searchResults
>> (REQUEST=request)"
>>
>> i suspect that the catalog was able to acquire REQUEST via
>> self.REQUEST
>> and this isn't working anymore. has anyone had a similar problem? i
>> don't know what i have changed leading to these kinds of problems...
>
> Apart from whether this worked previosuly or not, it is bad coding
> practice to rely on assumptions such as "it will somehow acquire the
> REQUEST". You should really change your code to explicity pass in
> REQUEST everywhere. Then you can stop worrying.
>
> jens
>
thanks for the answer, the coding style is one thing, and i don't have
the least bit of a problem to stick with this in the future (already
changed all the occurrences anyway to make it work again).

what i'm worried about is wether i did break anything else, possibly
with even worse results... (i don't like hidden bugs)

btw. is it also bad practice to use self.REQUEST in methods?
what about def foo(self, REQUEST=None), when and how is REQUEST
passed there? is it also not a good coding style, if not passing it directly?

regards, juergen herrmann
_______________________________________________________________________

>> XLhost.de - eXperts in Linux hosting <<

Jürgen Herrmann
Bruderwöhrdstraße 15b, DE-93051 Regensburg

Fon:  +49 (0)700 XLHOSTDE [0700 95467833]
Fax:  +49 (0)721 151 463027
WEB:  http://www.XLhost.de


More information about the Zope mailing list