templates¶
Templates module.
-
class
homer.templates.
Renderer
(base_path: str)[source]¶ Bases:
object
Load and render templates.
Initialize the instance.
- Parameters
base_path (str) -- the base path to initialize the Jinja2 environment with. All templates path must be relative to this base path.
-
render
(template_name: str, data: Mapping) → str[source]¶ Render a template with the given data.
- Parameters
- Raises
HomerError -- on error.
- Returns
the rendered template on success. None: on failure.
- Return type