Home | Trees | Indices | Help |
---|
|
object --+ | TemplateProcessor
TemplateProcessor provides an extendable framework for working with Jinja2 templates. It allows for specifying a template file and an (optional) output file. It sets up everything necessary for Jinja2 to function, then processes the template and handles its output.
To use this class for your own purposes, just sub-class it and override the relevant functions. The process method controls the general flow, and the other methods handle specific functions within the flow.
Sample Code::
from sabx_templating import TemplateProcessor TemplateProcessor().process()
Sample Usage::
$ sample.py -o sample.out sample.jinja2
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
Sets up handling for command-line options using the optparse module from the Python standard library. Creates the option "-o" for specifying an output file and the "-m" option for printing the man-page type full help screen.
|
Process the options passed in on the command line. Make sure that a template file name is provided, either on the command line or via the constructor. If the template file is passed on the command line, it's expected to be the first non-optional argument.
|
Setup the output file, setup the environment, then process the template file. Put the processed template into the output file. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Sat May 1 23:03:31 2010 | http://epydoc.sourceforge.net |