A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/087083.html below:

passing arguments from CGI to function

passing arguments from CGI to functionSteve Holden sholden at holdenweb.com
Sun Apr 22 14:11:59 EDT 2001
[posted and mailed]

Carlos:

A better-formatted version might be easier to debug!

regards
 Steve

"Carlos Araya" <elrond25 at MailAndNews.com> wrote in message
news:3AFCE8F4 at MailAndNews.com...
> CGI Error(s)I have the script below, where I request information from a
form. After making sure that the from has the fields I need, I would like
for it to write the information to a file. How do I pass the CGI fields to
another function? Thanks Carlos-- Script so far #!/usr/local/bin/python """
""" import cgi,sys,os,string #import smtplib form = cgi.FieldStorage() # CGI
parsing function def SendError(field): print """ Content-Type: text.html\n
\n The following errors were detected in the form: error_list Please go back
using the back button in your browser and corrent the errors before
submitting the form again. \n""" def WriteData(): # Should I put the fomr
variable here in order to be able to write the form fields to a file? file =
open(FormData.txt,a) # How do I pass the fields of the form to this function
so I can write them on # a file? # Change this value for your specific form
required = ['name', 'email', 'comment'] for item in required: if not
form.has_key(item): error_list += item if error_list != "":
SendError(error_list) else: WriteData()
>



More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4