Next / Previous / Contents / TCC Help System / NM Tech homepage

10.3. hist.cgi: Imports

hist.cgi
# - - - - -   I m p o r t s

We need sys because Web pages are written to the standard output stream.

hist.cgi
import sys

Python's tempfile module handles the creation of temporary files, which we need in the PDF generation process. We'll also need the standard os module to manipulate file names.

hist.cgi
import tempfile
import os

We use the standard Python re package for pattern-matching.

hist.cgi
import re

The common module is imported as lib.

hist.cgi
import cbchistlib as lib

Section 9, “regform.py: Form constants for the regional index page” declares constants related to the form that is constructed by regx.cgi that sends values to hist.cgi.

hist.cgi
import regform

We'll need the xnomo3 module to sort bird names into phylogenetic order. We also need the abbr module from this suite, but to avoid conflict with local variables named abbr, we call it abbrMod.

hist.cgi
import xnomo3
import abbr as abbrMod

The tccpagesox module wraps the page content in the standard style and navigational links.

hist.cgi
import tccpagesox as tp

Unlike the other two scripts in this system, this script generates its XHTML via sox.py: Sequential Output of XML for Python

hist.cgi
from sox import Sox

Generation of PDF output also uses sox, and also fosox, a module that assists in the generation of XSL-FO output using sox.

hist.cgi
import fosox as fo

We use the standard Python cgi module to retrieve values from the regional index form.

hist.cgi
import cgi
import cgitb
####cgitb.enable()  # Uncomment for debugging

The singleton module is part of one of the author's standard libraries, and is used as a parent class for Section 10.37, “class HistArgs(): CGI argument processing”.

hist.cgi
import singleton

Conversion of XSL-FO to PDF is done using an XML-RPC server.

hist.cgi
import xmlrpclib