pyopmnearwell.utils.mako module#
Render Mako templates used by pyopmnearwell.
- fill_template(var, filename=None, text=None)[source]#
Fill a Mako template with the given variables.
The template is loaded from
filenameor supplied directly throughtext. If rendering fails, the formatted Mako traceback is reported through the pyopmnearwell command-line error helper so the template can be debugged.- Parameters:
var (dict) -- Variables exposed to the Mako template during rendering.
filename (str | pathlib.Path | None, optional) -- Path to the template file. This may be omitted when
textis supplied.text (str | None, optional) -- Template source supplied directly as a string. This may be omitted when
filenameis supplied.
- Returns:
Rendered template text.
- Return type:
- Raises:
SystemExit -- If the template cannot be rendered.