Merge pull request #12575 from hulu/unicode_jinja

Fix unicode conditional in jinja template fixes #12564
This commit is contained in:
Thomas S Hatch 2014-05-06 16:07:42 -06:00
commit 776280a034

View File

@ -258,7 +258,10 @@ def render_jinja_tmpl(tmplstr, context, tmplpath=None):
# Let's try UTF-8 and fail if this still fails, that's why this is not
# wrapped in a try/except
unicode_context[key] = unicode(value, 'utf-8')
if isinstance(value, unicode):
unicode_context[key] = value
else:
unicode_context[key] = unicode(value, 'utf-8')
try:
template = jinja_env.from_string(tmplstr)