can't get cgi values

robert no-spam at no-spam-no-spam.invalid
Mon Nov 27 13:51:22 EST 2006


ronrsr wrote:
> I'm having trouble extracting cgi parameters in my code - this is a web
> application, so I only know the line that's causing the problem.

if exceptions try "import cgitb; cgitb.enable()" to get a traces directly in HTML for testing; otherwise read the server log (logs of httpd etc.) for traces

> 
> here's the info I know:
> 
> form = FieldStorage(None, None, [MiniFieldStorage('zid', '17'),
> MiniFieldStorage('keywords', 'aAUA'), MiniFieldStorage('keywords',
> 'aBOS'), MiniFieldStorage('citation', '<i>The Earth Times Monthly</i>,
> April 2002\\r\\n       \\r\\n       \r\n       '),
> MiniFieldStorage('quotation', 'Farm support goes mainly to a relatively
> small number of agri-businesses, many of them large corps. Yet these
> subsidies are 6 times what rich countries provide in foreign aid to a
> developing world that includes 5 billion people.\\r\\n       \r\n
> '), MiniFieldStorage('updatebutton', 'Update')])
> form.has_key("citation") = True
> 
> 
> 
>      fileHandle.write("here aer the haskeys");
>      fileHandle.write( str(form.has_key("citation")))
>     /* returns TRUE */
> 
>      temp = str(form("citation").value)
>          /* python stops here,
> 
>             form("citation appears to be undefined */
> 
> 
> 
>      print (str(form("citation").value))
>   /* this doesn't work, either */
> 


try "form['citation']"

why the Python cgi module and the documentation is a horror, read: <ek6ncq$7pp$1 at news.albasani.net>


Robert

> 
> 
>      if form.has_key("keywords"):                                  /*
> neither does this */
>          keywords = str(form["keywords"].value)
>      else:
>           keywords = "k"
> 
>   
> 
> 
> 
> 
> any ideas on what the problem is? 
> 
> thank you so much. 
> 
> -rsr-
> 



More information about the Python-list mailing list