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

4. Code prologue

The implementation of tccpage.py is included here in “literate programming” style. For information on the tool used for code generation, see A source extractor for lightweight literate programming.

The actual code starts with the conventional Python documentation string:

tccpage.py
"""tccpage.py: For dynamic generaton of web pages in standard TCC style.

    For documentation, see:
        http://www.nmt.edu/tcc/projects/tccpage/
"""

Next, some imports. We need the sys module so we can use sys.stdout as the default output file. We need the time module for timestamping the page.

tccpage.py
#================================================================
# Imports
#----------------------------------------------------------------

import sys
import time

Also, we'll need to import the xmlcreate.py module discussed in Python and the XML Document Object Model (DOM).

tccpage.py
import xmlcreate as xc