From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Philip Kilner
I'm having problems with testing for the existence of a key in my request. I've had similar problems in the past, and asked the list in the past, but always managed to fumble my way out of them - now I seem to be 100% stuck!
I'm working on a page template which calls a python script. This script needs to: -
- Test for the existence of a counter called "job_step". - If it does not exist, initialise it as one (it's an integer). - If it does exist, perform conditional tasks based on it's value.
My script reads, in part: -
req = context.REQUEST
if req.has_key('job_step'):
if req.job_step == 1: do that...
...and that's where my problem lies - the test /always/ fails!
_Which_ test fails? 1) if req.has-key(), or 2) if req.job_step == 1 If the latter, you are getting the form data as a string, and you have to convert it into an integer to get what you want. Cheers, Tom P