1.11 web.template -- For the easy display of data as HTML/XML

The web.template module currently only provides one function, pasrse(), used to parse a template.

parse( type='python', dict=None [,file=None][,template=None][,useCompiled='auto'])
Simple wrapper method to load and parse a template from the options given.
type
The type of template to parse. Can be 'python', 'cheetah', 'xyaptu' or 'dreamweaverMX'. A 'python' template is a string using the dictionary filling format.
dict
A dictionary of values used to fill the template
file
The file containing the template. If not specified or None, template must be specified.
template
The template as a string. If not specified or None, file must be specified.
useCompiled
Only used for Cheetah. Specifies whether or not a compiled version of the template should be used.

Simple example:

>>> import web.template
>>> print web.template.parse(dict={'w':'World!'}, template="Hello %(w)s")
Hello World!

This is the same as doing this in Python:

>>> print "Hello %(w)s"%{'w':'World!'}
Hello World!


Subsections
See About this document... for information on suggesting changes.