From 775d6fe1f731baae01ed68015adba0756372a752 Mon Sep 17 00:00:00 2001 From: noah morrison Date: Thu, 6 Nov 2014 15:34:32 -0500 Subject: [PATCH] Fixed python 2 StringIO bug In python 2 strings were not being converted to StringIOs. The new method assumes that template is a string and tries to convert it to a StringIO. If that fails then it assumes a file-like object. --- entei.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entei.py b/entei.py index 7e57a63..6d6eef4 100755 --- a/entei.py +++ b/entei.py @@ -63,8 +63,10 @@ def tokenize(template): '&': 'no escape' } - if type(template) is str: + try: template = StringIO(template) + except TypeError: + pass open_sections = [] l_del = '{{' -- 2.47.3