# - - - - - I m p o r t s
We need sys because Web pages are written to
the standard output stream.
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.
import tempfile import os
We use the standard Python re package for
pattern-matching.
import re
The common module is imported as lib.
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.
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.
import xnomo3 import abbr as abbrMod
The tccpagesox
module wraps the page content in the standard style
and navigational links.
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
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.
import fosox as fo
We use the standard Python cgi module to
retrieve values from the regional index form.
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”.
import singleton
Conversion of XSL-FO to PDF is done using an XML-RPC server.
import xmlrpclib