elliptic.Kernel.TemplateManager module

class elliptic.Kernel.TemplateManager.TemplateManagerBase(package, templates_folder)[source]

Bases: object

Class for abstracting interactions with the jinja2 templating package.

Example

Creating a template manager that uses the Templates folder found inside the current package when searching for template files.

>>> class MyTemplateManager(TemplateManagerBase):
>>>     def __init__(self) -> None:
>>>         super().__init__(__package__, 'Templates')
Parameters:
  • package (str) – The path to a python package containing the templates folder.
  • templates_folder (str) – The name of the templates folder.
get_template(template_file)[source]

Returns the template object corresponding to the given template file.

Parameters:template_file (str) – The template file.
Return type:Template
render(template_file, **kwargs)[source]

Returns the rendered template, passing in kwargs as template arguments.

Parameters:
  • template_file (str) – The template file.
  • kwargs (str) – The arguments to be passed to the template.
Return type:

str