[Tutor] Assistance!

Luis N tegmine at gmail.com
Sun Aug 7 22:00:57 CEST 2005

On 8/7/05, gordnjen <gordnjen at rogers.com> wrote:
> I am now stuck again. I am at my wit's end. The course I am taking is a
> supposed "beginners" course. It is a distance education class, and our
> textbook does NOT contain the information required to do all of the
> assignments (perhaps it was designed for people with more experience and/or
> knowledge?). Anyways, our latest assignment is that we have to create a
> working chequebook (view here:
> http://cmpt165.cs.sfu.ca/~ggbaker/examples/chequebook.html)
> This is what I have so far (see attached).
> I am so completely lost.
> Our textbook does not tell us how to implement a password security system on
> a website, or how to store data.
> The project is already over a week late, and I feel absolutely hopeless
> about it.
> Could you possibly give me some pointers on this? Please, please please?
> Thank you in advance,
> Jennine Gates

Hi Jennine,

To complete this assignment you will be writing a CGI. From the
website it appears that you have not had to write one before that used
form data. To use form data with python, you should use the cgi
module. You can examine the documentation for this module by pressing
F1 while within IDLE, and entering the module list.

Here's a simple example:


print "Content-type: text/html\n\n"

import cgi

def main(form):
    if form.has_key("Name"):
        print "<p>Name: %s</p>" % form["Name"].value
        print """<form
action="http://cgi.sfu.ca/~rbnewby/cgi-bin/example.cgi" method="get">
                     <input type="text" name="Name" value="Jennine" />
                     <input type="submit" value="submit">

if __name__ == "__main__":

A working example is viewable at: 


Depending upon the requirements of the assignment you may be able to
password protect the script with htauth, details here:




More information about the Tutor mailing list