From 22016ee593d6047855964734a17120d2aea6b5a5 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 21 Aug 2012 13:32:51 -0400 Subject: lots of various py3k fixes --- src/lib/Bcfg2/Server/Plugins/TGenshi.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/TGenshi.py') diff --git a/src/lib/Bcfg2/Server/Plugins/TGenshi.py b/src/lib/Bcfg2/Server/Plugins/TGenshi.py index 846c2a464..c84e0a506 100644 --- a/src/lib/Bcfg2/Server/Plugins/TGenshi.py +++ b/src/lib/Bcfg2/Server/Plugins/TGenshi.py @@ -1,12 +1,10 @@ """This module implements a templating generator based on Genshi.""" -import binascii import logging import sys import Bcfg2.Server.Plugin -# py3k compatibility -if sys.hexversion >= 0x03000000: - unicode = str + +from Bcfg2.Bcfg2Py3k import unicode, b64encode logger = logging.getLogger('Bcfg2.Plugins.TGenshi') @@ -99,7 +97,7 @@ class TemplateFile: else: if entry.get('encoding') == 'base64': # take care of case where file needs base64 encoding - entry.text = binascii.b2a_base64(textdata) + entry.text = b64encode(textdata) else: entry.text = unicode(textdata, self.encoding) else: -- cgit v1.2.3-1-g7c22