Trouble with the CGI
lucifer@e...
lucifer@e...
Mon, 16 Apr 2001 22:41:05 -0000
I've written my own code to replace cgi.Fieldstorage() but I don't
know if it will be ok for you.
Has anybody ever got cgi.FieldStorage() to work inside medusa ?
--- In medusa@y..., Ernesto Nadir Crespo Avila <ecrespo@u...> wrote:
>
>
> El Mar 10 Abr 2001 12:24, escribiste:
> > It's been a while since I've workd with cgi.py but I believe your
problem
> > is in reading datos['name']. Try datos['name'].value instead.
> > datos['name'] may contain a list or string, so adapt your code
accordingly.
> Thank you.
>
> But, now just appear:
>
> there´s no data
>
> And
>
> FieldStorage(None, None, [])
>
> Bye, Ernesto Crespo
>
>
> # -*- Mode: Python; tab-width: 4 -*-
> # send and process a POST form
> import cgi
>
> print '<html>'
> print '<head>'
> print '<meta http-equiv="Content-type" content="text/html">'
> print
> print '<title> A Cgi example with Phyton</title>'
> print '</head>'
> print '<body>'
> datos = cgi.FieldStorage()
>
> if datos.has_key('name'):
> print '<h1> Your data: %s</h1>' %datos['name'].value
> else:
> print '<h1>there´s no data</h1>'
> print datos
> print '</body>'
> print '</html>'