From: noah morrison Date: Tue, 18 Nov 2014 02:33:17 +0000 (-0500) Subject: python 3 working X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=02e96c4186130b325edd6f28c265bdb458dbe85a;p=chevron.git python 3 working --- diff --git a/entei.py b/entei.py index 447c2b4..59f1902 100755 --- a/entei.py +++ b/entei.py @@ -2,7 +2,14 @@ import json -from sys import argv +from sys import argv, version + +python3 = False +if version > '3': + python3 = True + + def unicode(x, y): + return x class UnclosedSection(Exception): """Raised when you have unbalanced section tags""" @@ -360,9 +367,15 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache', part_out = part_out.rstrip(' ') # Add the partials output to the ouput - output += part_out.decode('utf-8') + if python3: + output += part_out + else: + output += part_out.decode('utf-8') - return output.encode('utf-8') + if python3: + return output + else: + return output.encode('utf-8') def main(data, template, **kwargs):