Search code examples
pythontemplatesmako

Get variables out of mako Template.render() objects in python?


Is there a way to get the variables from a Template object that was previously created with Template.render(...) in python? I couldn't find any getters in the docs...

Thanks!


Solution

  • Your question contains a wrong assumption:

    from a Template object that was previously created with Template.render(...)

    According to the code, Template.render() or Template.render_unicode() return a byte string or a unicode object, respectively (no "Template object"!). In that case, there is no way to retrieve the variables used for rendering the template, that information is lost.