cgipm

cgipm User Manual

Table of Contents

Overview

This is a CGI.pm workalike, implementing much of the perl module's functionality, and as much of the syntax as I could fit into python. It should feel comfortable to a perl programmer.

See also the Developer's guide

Installation

The standard approach:

  gzip -cd cgipm-0.1.tar.gz | tar xvf -
  cd cgipm-0.1
  (read the code -- assure yourself it is safe)
  python setup.py build
  python setup.py test
  python setup.py install  (as root)

Quick Start

Depending on your presonal preferences for style, use one of the test scripts as an example:

script style
../test/test01.pyOO; your class inherits cgipm.CGI
../test/test02.pyin-line; you instantiate a query object and use it as a global
-

Tutorial

Build a hello, world

Use mkpythonproj to generate a new project dir:

  mkpythonproj.py -p --author="myname" hellocgi

Edit the resulting hellocgi.py, inserting you chosen style of testxx.py. Make a testinput file similar to input.dat, but with data for your situation. Just do a couple of fields at first.

Edit the test script:

  cd test
  (edit "go" to read:)
  ../hellocgi.py < input.dat

  (edit an input.dat file to have your name=value pairs)
  mytxt="abc def"
  myint=123

  (go back to main level)
  cd ..      

Try it:

  python setup.py test

You will have to resolve syntax errors, and then make sure a good web page is being printed. Once that is true, prepare for test installation....

Edit setup.py's installation configuration section

  exec_prefix=sys.exec_prefix   <-- set to your cgi-bin dir
  ...
  pkgfiles=[]                   <-- set this one empty        
  binscripts=['hellocgi.py']    <-- add the cgi script

Then run it:

  python setup.py install

You may have to run this as root, but it is better to provide a testdir which can safely be used for testing cgi's.

Then of course, try it out. Point to the cgi, Have it generate a form, fill in the form, and submit the form. Confirm that the response is as intended.

This is the development cycle as you grow the application. Test syntax and functionality via the debugging mechanism, then test web-compatibility with the actual cgi-bin.

Reference

Instead of trying to describe all the tags and their uses, I suggest downloading the HTML specs and reading those as needed.


Creator: Harry George
Updated/Created: 2000-04-01