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/Snapshots.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Snapshots.py') diff --git a/src/lib/Bcfg2/Server/Plugins/Snapshots.py b/src/lib/Bcfg2/Server/Plugins/Snapshots.py index 666beef21..e62638b4f 100644 --- a/src/lib/Bcfg2/Server/Plugins/Snapshots.py +++ b/src/lib/Bcfg2/Server/Plugins/Snapshots.py @@ -1,9 +1,5 @@ -#import lxml.etree import logging -import binascii import difflib -#import sqlalchemy -#import sqlalchemy.orm import Bcfg2.Server.Plugin import Bcfg2.Server.Snapshots import Bcfg2.Logger @@ -13,8 +9,7 @@ import time import threading # Compatibility import -from Bcfg2.Bcfg2Py3k import Queue -from Bcfg2.Bcfg2Py3k import u_str +from Bcfg2.Bcfg2Py3k import Queue, u_str, b64decode logger = logging.getLogger('Snapshots') @@ -45,13 +40,12 @@ def build_snap_ent(entry): if entry.get('encoding', 'ascii') == 'ascii': desired['contents'] = u_str(entry.text) else: - desired['contents'] = u_str(binascii.a2b_base64(entry.text)) + desired['contents'] = u_str(b64decode(entry.text)) if 'current_bfile' in entry.attrib: - state['contents'] = u_str(binascii.a2b_base64( \ - entry.get('current_bfile'))) + state['contents'] = u_str(b64decode(entry.get('current_bfile'))) elif 'current_bdiff' in entry.attrib: - diff = binascii.a2b_base64(entry.get('current_bdiff')) + diff = b64decode(entry.get('current_bdiff')) state['contents'] = u_str( \ '\n'.join(difflib.restore(diff.split('\n'), 1))) -- cgit v1.2.3-1-g7c22