mako#
- class litestar.contrib.mako.MakoTemplate#
- Bases: - TemplateProtocol- Mako template, implementing - TemplateProtocol
- class litestar.contrib.mako.MakoTemplateEngine#
- Bases: - TemplateEngineProtocol[- MakoTemplate,- Mapping[- str,- Any]]- Mako-based TemplateEngine. - __init__(directory: Path | list[Path] | None = None, engine_instance: Any | None = None) None#
- Initialize template engine. 
 - get_template(template_name: str) MakoTemplate#
- Retrieve a template by matching its name (dotted path) with files in the directory or directories provided. - Parameters:
- template_name¶ – A dotted path 
- Returns:
- MakoTemplate instance 
- Raises:
- TemplateNotFoundException – if no template is found. 
 
 - register_template_callable(key: str, template_callable: Callable[[Concatenate[Mapping[str, Any], P]], T]) None#
- Register a callable on the template engine. 
 - render_string(template_string: str, context: Mapping[str, Any]) str#
- Render a template from a string with the given context. 
 - classmethod from_template_lookup(template_lookup: TemplateLookup) MakoTemplateEngine#
- Create a template engine from an existing mako TemplateLookup instance. - Parameters:
- template_lookup¶ – A mako TemplateLookup instance. 
- Returns:
- MakoTemplateEngine instance