filters escaping html code by default

142 views
Skip to first unread message

mk

unread,
Jan 9, 2009, 7:41:14 AM1/9/09
to Mako Templates for Python
Hello everyone,

I'm new Pylons user and I use Mako templates. By default it seems that
Mako is escaping HTML characters like follows in Pylons helper (${h}
variable in template):

template:

${h.link_to('FrontPage', h.url_for(action="index",
title="FrontPage"))}

Rendered HTML source:

<a href="/?title=FrontPage">FrontPage</a>

Now I *can* turn that off with:

${h.link_to('FrontPage', h.url_for(action="index", title="FrontPage"))|
n}

But is it possible to make it default? Is this my misconfiguration of
Mako or a bug somewhere?

I have Pylons 0.9.7 installed (via easy_install, with all the
dependencies), Mako appears to be 0.2.4 (mako-0.2.4-py2.5.egg), Python
2.5.2 and it seems

Regards,
mk

Michael Bayer

unread,
Jan 9, 2009, 12:12:39 PM1/9/09
to mako-d...@googlegroups.com


change the default filters in your environment.py file, where Pylons
configures the TemplateLookup (big win using Pylons 0.9.7 here...).
check the mako docs on fitering for some of the available options.

Reply all
Reply to author
Forward
0 new messages