A Sample Template File
A template file is simply an HTML file (or any text file
for that matter), which contains symbols which mark where substitutions
will be made. The symbols are always delimited by curly braces {like_this}.
The name between the braces is a valid python symbolic name, i.e. alphanumeric
or underscore characters. The idea is that for each occurence of
these symbols a dictionary will be consulted using that key and the found
value is substituted in its place. Anything with a string representation
can be used as the substituted value, including other complex HTMLgen objects
such as tables, lists, etc.
The TemplateDocument class is instantiated with a template file and
then a dictionary, or an object which acts like a dictionary (has a get()
method) like UserDict, is assigned to the substitutions attribute. At
that point the instance can be written to a file and all substitutions
will be performed.
The Agency disavows any knowledge of your actions, Mr. Phelps.