[Zope] Request & has_key

Philip Kilner phil at xfr.co.uk
Wed Apr 21 15:43:34 EDT 2004


Hi Matt,

Thanks for the response,

Matt Hamilton wrote:
>   Ummm... I'm still not quite clear what you are trying to achieve 
> above.  From what I gather it is like some kind of state machine and you 
> want to move from page to page depending on the state, right?  Well you 
> do a container.REQUEST.set at the end.  REQUEST shoudl come from 
> context, not from container.  Also, what is the point in setting it? The 
> REQUEST object is different for each individual HTTP request, it will 
> not persist between requests.  In order to do this you should be setting 
> and checking the data in REQUEST.SESSION instead.
> 

Kind off...in fact, my "state machine" is flipping through a sequence of 
formulator forms to collect the data for a database write in the final 
step. And yes, I'm using container.REQUEST.set, and this is done at each 
step, carrying the the logic through the multi-step process. Ironically, 
this is all the stuff that works.

The single element which defeats me is that in order for the process to 
run, I need to check whether I'm on the first pass and initialise my key 
at one if so, increment it if not.

I don't think I've asked a very coherent question (been staring at it 
too long) based on the responses.

My real question is: -

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

...and as a supplementary: -

- is REQUEST or req a "real" dictionary, anyway?

Cheers,

PhilK




More information about the Zope mailing list