use repr here
diff --git a/mako/ext/babelplugin.py b/mako/ext/babelplugin.py
index 3b2bf51..4721949 100644
--- a/mako/ext/babelplugin.py
+++ b/mako/ext/babelplugin.py
@@ -78,9 +78,9 @@
elif isinstance(node, parsetree.CallNamespaceTag):
attribs = ', '.join(['%s=%s' % (
key,
- "'%s'" % val
- if not val.startswith('${')
- else val
+ repr(val)
+ if not val.startswith('${')
+ else val
)
for key, val in node.attributes.items()])
diff --git a/test/templates/gettext.mako b/test/templates/gettext.mako
index 9c01b61..367af55 100644
--- a/test/templates/gettext.mako
+++ b/test/templates/gettext.mako
@@ -80,7 +80,7 @@
<%def name="panel()">
-${_(u'foo')} <%self:block_tpl title="#123", name="_('baz')" value="${_('hoho')}">
+${_(u'foo')} <%self:block_tpl title="#123", name="_('baz')" value="${_('hoho')}" something="hi'there" somethingelse='hi"there'>
${_(u'bar')}
diff --git a/test/test_babelplugin.py b/test/test_babelplugin.py
index 6b867ee..4118f4a 100644
--- a/test/test_babelplugin.py
+++ b/test/test_babelplugin.py
@@ -3,10 +3,12 @@
try:
import babel
- from mako.ext.babelplugin import extract
except:
babel = None
+if babel is not None:
+ from mako.ext.babelplugin import extract
+
import os