[Edu-sig] Passing parameters to eval.

Kirby Urner urnerk@qwest.net
Wed, 26 Sep 2001 22:02:25 -0700


>
>by other functions so i don't have to worry what
>parameters to be passed. Any good alternative to this
>problem? Thanks a lot.
>
>Kim Titu

cgi.FieldStorage() will contain all the passed
parameters in one place when the main script is
called, so why not have all your functions take
a single parameter e.g.

   form = cgi.FieldStorage()

   funname = "fun"

   eval(funname+"(form)")

Then each function can figure out what to do
with the information in your single parameter
object (treatable as a dictionary, i.e. with
keys and values).

Kirby