asphalt.templating.renderers.mako

class asphalt.templating.renderers.mako.MakoRenderer(package_paths=(), **lookup_options)

Renders Mako templates.

Note

By default, the filesystem_checks argument of TemplateLookup is set to the value of the __debug__ variable. This means that in production mode, it will not check for template changes. If a template is edited in production mode, the application must be restarted for the changes to take effect.

Parameters:
  • package_paths – if given, looks up the directories containing the given package and fills in the directories argument for TemplateLookup. The value will be interpreted by package_to_directory().

  • loader_args – extra arguments to pass to TemplateLookup

render(template, **vars)

Render the named template.

Parameters:
  • template (str) – name of the template file, relative to any of the configured template directories

  • vars (Any) – extra context variables made available to templates

Return type:

str

Returns:

the rendered results

render_string(source, **vars)

Render the template contained in the given string.

Parameters:
  • source (str) – content of the template to render

  • vars (Any) – extra variables made available to the template

Return type:

str

Returns:

the rendered results