From 5e138ace2c90cb07f09fb577f3f70e251a1deba2 Mon Sep 17 00:00:00 2001 From: Alessandro Molina Date: Tue, 28 Aug 2012 22:23:37 +0200 Subject: [PATCH] Mark attrs as Markup to avoid double escaping --- tw2/core/mako_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tw2/core/mako_util.py b/tw2/core/mako_util.py index 82201a8..e912149 100644 --- a/tw2/core/mako_util.py +++ b/tw2/core/mako_util.py @@ -2,6 +2,7 @@ from mako.runtime import Undefined from copy import copy +from markupsafe import Markup from cgi import escape #from mako.filters import xml_escape @@ -27,7 +28,7 @@ def attrs(context, args=None, attrs=None): new_attrs = [u'%s="%s"' % (k, escape(unicode(k in bools and k or v), True)) for k, v in args.iteritems() if (k not in bools and v is not None) or (k in bools and v)] - return u" ".join(new_attrs) + return Markup(u" ".join(new_attrs)) def compat(context, attr):