From cea2f2a7cf2c0922dc9e68a296a1049cec774d8d Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 2 Feb 2015 19:08:10 -0800 Subject: [PATCH] remove broken nad commented unicode conversion -- in v2, this is done when the data first enters ansible. --- v2/ansible/template/__init__.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/v2/ansible/template/__init__.py b/v2/ansible/template/__init__.py index 6571dca2581..46bbc06a07d 100644 --- a/v2/ansible/template/__init__.py +++ b/v2/ansible/template/__init__.py @@ -126,7 +126,7 @@ class Templar: result = variable if self._contains_vars(variable): result = self._do_template(variable, preserve_trailing_newlines=preserve_trailing_newlines) - + # if this looks like a dictionary or list, convert it to such using the safe_eval method if (result.startswith("{") and not result.startswith("{{")) or result.startswith("["): eval_results = safe_eval(result, locals=self._available_variables, include_exceptions=True) @@ -203,10 +203,6 @@ class Templar: def _do_template(self, data, preserve_trailing_newlines=False): try: - # FIXME: is this even required? it seems to conflict with the lines - # below which do the same thing? - #if isinstance(data, str): - # data = unicode(data, 'utf-8') environment = Environment(trim_blocks=True, undefined=StrictUndefined, extensions=self._get_extensions(), finalize=self._finalize) environment.filters.update(self._get_filters()) @@ -220,13 +216,6 @@ class Templar: # if os.path.exists(filesdir): # basedir = filesdir - # from issue #6227, make sure unicode is handled properly - if isinstance(data, unicode): - try: - data = data.decode('utf-8') - except UnicodeEncodeError, e: - pass - try: t = environment.from_string(data) except TemplateSyntaxError, e: