Source: factory.core/ObjTemplate.py
Template management and rendering engine.
Supports two template stores:
def_template — page/report templates (legacy)
def_email_template — email templates with subject,
...
| Method | Signature | Description | |
|---|---|---|---|
| read_page_template | read_page_template(template_name: str) -> str |
Read and render a page template. | |
| load_email_template | load_email_template(template_code: str, package: str = '') -> Dict[str, str] |
Load an email template by code. | |
| render_email | render_email(template_code: str, context: Optional[Dict[str, str]] = None, package: str = '') -> Dict[str, str] |
Render an email template with context. | |
| send_email | send_email(template_code: str, to_address: str, context: Optional[Dict[str, str]] = None, remote_connection: str = '', attachments: Optional[list[str]] = None, package: str = '') -> str |
Render and send an email template. | |
| save_email_template | save_email_template(template_code: str, subject: str, body: str, channel: str = 'Email', layout: str = '', description: str = '', package: str = '', engine: str = 'legacy') -> None |
Insert or update an email template. | |
| list_email_templates | list_email_templates(package: str = '') -> list[Dict[str, str]] |
List all email templates for a package. | |
| build_email_html_jinja | build_email_html_jinja(title: str, body_html: str, subtitle: str = '') -> tuple[str, list[str]] |
Wrap body HTML using Jinja2 branded template. | |
| get_logo_path | get_logo_path(package: str = '') -> str |
Return the filesystem path to the package | |
| render_mermaid | render_mermaid(mermaid_text: str, accent: str = '', accent2: str = '') -> str |
Render Mermaid diagram text to a PNG file. | |
| build_email_html | build_email_html(title: str, body_html: str, subtitle: str = '') -> tuple[str, list[str]] |
Wrap body HTML in a branded email layout. | |
| section | section(title: str, headers: list[str], rows_html: str, heading_level: int = 2) -> str |
Build an HTML section with heading + table. | |
| kv_row | kv_row(label: str, value: str) -> str |
Build a two-column table row. | |
| status_cell | status_cell(text: str, status: str = '') -> str |
Build a | with color hint for status. |
| summary_box | summary_box(content: str) -> str |
Build a highlighted summary box. | |
| Read | Read() |
Legacy alias for read_page_template. |
Render a template to stdout.
List email templates.
Send an email template.
Save an email template.