[Zope] Keys in Request

Philip Kilner phil at xfr.co.uk
Wed Mar 3 06:44:21 EST 2004


Hi Chris, Robert,

Thanks for your replies!

Chris Withers wrote:
> if not request.form.has_key('the_key'):
> 
> ...if you're worried about for mvariables or URL parameters.
> 
> Otherwise:
> 
> value = request.get('the_key'):
> if value is not None:
> 

The variable actually isn't in the form, but is maintained by the script 
- although I've put it in the form just to make it work!

robert rottermann wrote:
 > Request is not a dictionary, it just behaves simmilar.
 > You could use sommething like:
 > the_key = request.get('the_key', None):
 > if the_key ...
 >

Didn't realise request was not a dictionary - explains a lot, but am 
mystified by how this /used/ to work! (This is not actually new code, 
but a refactoring exercise - but I've lost my "datum" somewhere along 
the way, and can't face all the "undo"-ing!

Will test and come back for posterity!

-- 

Regards,

PhilK

Email: phil at xfr.co.uk / Voicemail & Facsimile: 07092 070518

"The lyf so short, the craft so long to learne" - Chaucer




More information about the Zope mailing list