fix Mako template rendering in render_template_to_string()
Merge pull request #1439 from FelixSchwarz/mako-plugins-fixes

fix Mako template rendering in render_template_to_string()