httk.core.template module

httk.core.template.apply_template(template, output, envglobals=None, envlocals=None)[source]

Simple Python template engine.

The file ‘template’ is turned into a new file ‘output’ replacing the following: $name -> the value of the variable ‘name’ in the scope provided by locals and globals. $(python statement) -> result of evaluating the python statment. ${some python code} -> text on stdout from running that python code.

Note: it is safe for the code inside the template to load the file it eventually will replace.

httk.core.template.apply_templates(inputpath, outpath, template_suffixes='template', envglobals=None, envlocals=None, mkdir=True)[source]

Apply one or a series of templates throughout directory tree.

template_suffixes: string or list of strings that are the suffixes of templates that are to be applied. name: subdirectory in which to apply the template, defaults to last subrun created, or ‘.’ if no subrun have been created.