A tipical usage of Curtain is as simple as that:
from xml.saxutils import XMLGenerator
from curtain import Template
template = Template(file_source = '/path/to/template.ct')
xml_generator = XMLGenerator('/path/to/output.xml')
template(xml_generator, env = {'project': u'test'})
So, it all boils down to loading (and thus compile) a template file, instantiating an XML generator, and calling the template.
A compiled Curtain template.
Either str_source or file_source must be given, but not both. str_source is a str object containing the XML template (the parser will manage the encoding using the tipical XML encoding declaration and/or autodetection of characters encoding), whereas file_source can be either a str containing the path to an XML file with the template, or an open file-like object where data can be read from (again, the encoding is computed using the previous mechanisms).
auto_reload can be True only if file_source is given and is a path. In this case, the template will manage the auto-reloading of the template file if it is changed. This can cause quite a heavy performance hit, so it should be considered just as a development utility, and kept to off in production environments.
Execute the compiled template. Execution of the template implies that a sequence of XML SAX events are sent the xml_generator object, which must implement the xml.sax.handlers.ContentHandler interface. env is the environment in which the template is executed. See the language specification for more informations about that. translation_context is the context passed to the translate method. See Translation procedure. location is a Location object instance which will track the position in the source template file while execution is performed, so to have informations about where the computation has stopped in case of errors.