Some newbie cgi form questions...

googleboy mynews44 at yahoo.com
Sun Aug 7 20:14:10 EDT 2005


Robert Kern wrote:
> Diez B.Roggisch wrote:
> >>Traceback (most recent call last):
> >>  File "/var/www/users/senta/html/gobooks/cgi/form.py", line 35, in ?
> >>    if not form.keys()[key]:
> >>TypeError: list indices must be integers
> >>
> >>As you can see,  I am using python 2.3 (my web service provider is
> >>responsible for this - I'd use 2.4.1 if I could)
> >
> > That code above can't work - you want something like
> >
> > if not form.keys() in key:
>
> This thread has to rank somewhere in the top ten threads with respect to
> the density of obviously wrong code samples.

LoL!

Yeah, I am guessing I started out not too far from something that was
doing what I wanted until now, I have gradually moved further and
further away from stuff that looks to me like it should work as python
code.   I've even managed to turn code that was working into code that
is broken somehow...

At the moment this bit of code is about validating that stuff was
entered into the form properly, and about doing something with some
types of form inputs and not others.  I try all sorts of things and
they just give me exception errors.

And I just don't know what use to make of advice that says stuff like
"The form is not a dictionary."  :(

I have spent the whole weekend doing searches and reading tutorials on
this before I posted,  I have a form that I get working and doing most
of what I want.  It is just the last bits that I can't figure out, and
the tutes don't seem to cover the stuff I am trying to do.

O well,  I guess I will go bang my head against it or a few more days
and then hopefully an answer will show up in my brain somewhere.

Thanks for your help.

Googleboy.




More information about the Python-list mailing list