From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SjxfC-0008S6-BW for garchives@archives.gentoo.org; Wed, 27 Jun 2012 19:12:30 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 98D0CE0720; Wed, 27 Jun 2012 19:12:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6C020E0720 for ; Wed, 27 Jun 2012 19:12:12 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9C0951B4724 for ; Wed, 27 Jun 2012 19:12:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 64306E5432 for ; Wed, 27 Jun 2012 19:12:10 +0000 (UTC) From: "Sven Vermeulen" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Vermeulen" Message-ID: <1340530701.a1d3ade6fa42151f6a840c4754d87511eb75fa02.SwifT@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: support/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: support/pyplate.py X-VCS-Directories: support/ X-VCS-Committer: SwifT X-VCS-Committer-Name: Sven Vermeulen X-VCS-Revision: a1d3ade6fa42151f6a840c4754d87511eb75fa02 X-VCS-Branch: master Date: Wed, 27 Jun 2012 19:12:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: ea6b1f1f-5342-4469-8a0e-1252406ad173 X-Archives-Hash: 5ba06a4da2bc4ebea1ad0cf6666af01e commit: a1d3ade6fa42151f6a840c4754d87511eb75fa02 Author: Sven Vermeulen siphos be> AuthorDate: Sun Jun 24 09:38:21 2012 +0000 Commit: Sven Vermeulen siphos be> CommitDate: Sun Jun 24 09:38:21 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/hardened-refp= olicy.git;a=3Dcommit;h=3Da1d3ade6 Improve unicode support, needed for python3 --- support/pyplate.py | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/support/pyplate.py b/support/pyplate.py index c13cd88..2e5a938 100644 --- a/support/pyplate.py +++ b/support/pyplate.py @@ -82,7 +82,10 @@ class Template: file.close() =20 def parse_string(self, template): - file =3D io.StringIO(template) + if sys.version_info >=3D (3,0): + file =3D io.StringIO(template) + else: + file =3D io.StringIO(template.decode('utf-8')) self.parse(file) file.close() =20 @@ -288,7 +291,11 @@ class CommentTemplateNode(LeafTemplateNode): =20 class ExpressionTemplateNode(LeafTemplateNode): def execute(self, stream, data): - stream.write(str(eval(self.s, globals(), data))) + if sys.version_info >=3D (3,0): + stream.write(str(eval(self.s, globals(), data))) + else: + stream.write(str(eval(self.s, globals(), data)).decode('utf-8')) + =20 class ExecTemplateNode(LeafTemplateNode): def __init__(self, parent, s):