[Zope] Request & has_key

Philip Kilner phil at xfr.co.uk
Wed Apr 21 17:11:15 EDT 2004


Hi Ausum,

Ausum Studio wrote:
> The only way to pass a variable created as part of one request, to the
> following one (after you click 'submit' your browser generates a new one,
> even though you are calling the same template), is to have it as a form
> object, maybe as a hidden input tag. You can also perform the same via
> javascript.
> 

I understand.

I have a page template which is called multiple times, and contains 
conditional behaviour. The first time it is called the script needs to 
identify that it is the first time. The distinguishing characteristic of 
the first pass is the absence of a particular key in the request 
(because no form has been submitted, or script run, to set it - the 
controlling process has not been initialised).

Upon identifying that this is the first pass, a value is set using 
"container.REQUEST.set".

The processes managed by this page (it is generic, and intended to be 
used in a variety of scenarios) are 100% linear - in that at each step 
the transaction may pass or fail, but only a progression forwards 
through a predefined sequence  of forms is required. If it fails, the 
form is thrown again to permit the user to supply valid values. If it 
succeeds, a counter is incremented, and the next version is thrown. All 
this works fine.

My only real question is: -

- How can I reliably check for the existence of a given key in the request?

Cheers,

PhilK




More information about the Zope mailing list