[Zope] REQUEST not accessible

Jürgen Herrmann Juergen.Herrmann at XLhost.de
Thu Oct 13 08:38:16 EDT 2005


[ Jens Vagelpohl wrote:]
>
> On 13 Oct 2005, at 11:56, Jürgen Herrmann wrote:
>>> 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.
>>>
>>>
>> 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)
>
> By explicitly passing REQUEST? I doubt it.
No i meant that i already broke something that did work before:
obviously some code changes of mine lead to the results described before,
i assume it has to do with my code as i didn't install any products or
upgrade zope in the last 3 weeks, and the previous release (2 weeks ago)
the catalog search was working fine...
that, i suspected, might break things in other places too...
>
>
>> 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?
>
> The common case is to pass it in explicitly. To pass it in and avoid
> any surprises see the solution discussed above. Explicit is better
> than implicit.
>
> jens

juergen
_______________________________________________________________________

>> 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