Templates

View

class dragonfly.template.template.View(template, **kwargs)

Bases: object

Returns a HTML version (view) of the requested template. The class first attempts to locate the deisred view. If a pre-compiled python version of the template does not exist or is out of date, the class will generate one. Otherwise it imports the compiled python file and runs the get_html method, passing in any variables that the user.py has given to the constructor (via **kwargs). It then returns a Response with this HTML. :param template: The view to return :type template: str

make()

Returns a response with the generated HTML.

Returns:The Response
Return type:Response

Warning

The following classes should not be called directly.

Line

class dragonfly.template.template.Line(line, indent)

Bases: object

Object to represent a single line in the template file

reduce_indent()

Reduce the indent of the Line by 1

to_python()

Converts the Line to its Python equivalent

Converter

class dragonfly.template.template.Converter(file)

Bases: object

convert()

Convert the given file to Python.

Returns:The Python code.
Return type:str