Searching for a variable from ZPT.
Is their an easy way to search for a var in REQUEST? In my ZPT I have a look in REQUEST.SESSION, options and REQUEST.form for a var; it can get passed in several ways depending on what calls the ZPT. I would like one clean way. Not three conditions in my ZPT. Any ideas?
Hi, Am So, den 19.09.2004 schrieb Jason Leach um 19:10:
Is their an easy way to search for a var in REQUEST? In my ZPT I have a look in REQUEST.SESSION, options and REQUEST.form for a var; it can get passed in several ways depending on what calls the ZPT.
I would like one clean way. Not three conditions in my ZPT.
Do your logic outside of your ZPT, for example in a python script. Then you have your one clean way. Regards Tino Wildenhain
On Sun, Sep 19, 2004 at 10:10:15AM -0700, Jason Leach wrote:
Is their an easy way to search for a var in REQUEST? In my ZPT I have a look in REQUEST.SESSION, options and REQUEST.form for a var; it can get passed in several ways depending on what calls the ZPT.
I would like one clean way. Not three conditions in my ZPT.
You don't have to. The HTTPRequest class (or maybe one of its base classes) automagically combines all its categories, so request/foo should work regardless of whether it's in session, options, form, other... -- Paul Winkler http://www.slinkp.com
On Sun, 2004-09-19 at 21:35, Paul Winkler wrote:
On Sun, Sep 19, 2004 at 10:10:15AM -0700, Jason Leach wrote:
Is their an easy way to search for a var in REQUEST? In my ZPT I have a look in REQUEST.SESSION, options and REQUEST.form for a var; it can get passed in several ways depending on what calls the ZPT.
I would like one clean way. Not three conditions in my ZPT.
You don't have to. The HTTPRequest class (or maybe one of its base classes) automagically combines all its categories, so request/foo should work regardless of whether it's in session, options, form, other...
Not quite. REQUEST.SESSION needs to be explicitly used. REQUEST.sessionvariable won't work. This was an explicit decision at design time, although maybe one that isn't quite in the spirit of Zope 2. - C
participants (4)
-
Chris McDonough -
Jason Leach -
Paul Winkler -
Tino Wildenhain