mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #28581 from saltstack/revert-28134-2015.8
Revert b4875e585a
This commit is contained in:
commit
69081d00e0
1 changed files with 7 additions and 15 deletions
|
@ -290,20 +290,6 @@ def _get_jinja_error(trace, context=None):
|
|||
return line, out
|
||||
|
||||
|
||||
def _decode_recursively(object_):
|
||||
if isinstance(object_, list):
|
||||
return [_decode_recursively(o) for o in object_]
|
||||
if isinstance(object_, tuple):
|
||||
return tuple([_decode_recursively(o) for o in object_])
|
||||
if isinstance(object_, dict):
|
||||
return dict([(_decode_recursively(key), _decode_recursively(value))
|
||||
for key, value in six.iteritems(object_)])
|
||||
elif isinstance(object_, string_types):
|
||||
return salt.utils.locales.sdecode(object_)
|
||||
else:
|
||||
return object_
|
||||
|
||||
|
||||
def render_jinja_tmpl(tmplstr, context, tmplpath=None):
|
||||
opts = context['opts']
|
||||
saltenv = context['saltenv']
|
||||
|
@ -368,7 +354,13 @@ def render_jinja_tmpl(tmplstr, context, tmplpath=None):
|
|||
|
||||
jinja_env.tests['list'] = salt.utils.is_list
|
||||
|
||||
decoded_context = _decode_recursively(context)
|
||||
decoded_context = {}
|
||||
for key, value in six.iteritems(context):
|
||||
if not isinstance(value, string_types):
|
||||
decoded_context[key] = value
|
||||
continue
|
||||
|
||||
decoded_context[key] = salt.utils.locales.sdecode(value)
|
||||
|
||||
try:
|
||||
template = jinja_env.from_string(tmplstr)
|
||||
|
|
Loading…
Add table
Reference in a new issue