From: noah morrison Date: Thu, 6 Nov 2014 20:34:32 +0000 (-0500) Subject: Fixed python 2 StringIO bug X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=775d6fe1f731baae01ed68015adba0756372a752;p=chevron.git 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. --- 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 = '{{'