Search code examples
pythonpyramidmako

Is there a way to render mako template from a string?


I need to run render a mako template stored in a string in a database. The code should be like

emailtext = render(template_string, {})

Is there a way to do so without creating temporary .mako file?

Thanks in advance, Ivan.


Solution

  • Sure, it's the first example in the Mako docs: http://docs.makotemplates.org/en/latest/usage.html#basic-usage