From 44e43727be13e3554342c2b5b75b7dc42abdb18c Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sun, 30 Nov 2014 21:51:03 -0500 Subject: Checkpointing. By using `six` I think I have most of the imports squared away. There's probably still uses of `unicode` built-ins that need fixing. The idea is to first get the test suite running (which it doesn't yet), and then to fix tests. There's a bug in lazr.config which requires us to patch it for now. --- src/mailman/testing/helpers.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/mailman/testing/helpers.py') diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py index b0fe14a0d..1de0e98cf 100644 --- a/src/mailman/testing/helpers.py +++ b/src/mailman/testing/helpers.py @@ -59,8 +59,8 @@ from contextlib import contextmanager from email import message_from_string from httplib2 import Http from lazr.config import as_timedelta -from urllib import urlencode -from urllib2 import HTTPError +from six.moves.urllib_error import HTTPError +from six.moves.urllib_parse import urlencode from zope import event from zope.component import getUtility @@ -342,7 +342,7 @@ def call_api(url, data=None, method=None, username=None, password=None): if len(content) == 0: return None, response # XXX Workaround http://bugs.python.org/issue10038 - content = unicode(content) + content = content.decode('utf-8') return json.loads(content), response @@ -506,9 +506,8 @@ def specialized_message_from_string(unicode_text): """ # This mimic what Switchboard.dequeue() does when parsing a message from # text into a Message instance. - text = unicode_text.encode('ascii') - original_size = len(text) - message = message_from_string(text, Message) + original_size = len(unicode_text) + message = message_from_string(unicode_text, Message) message.original_size = original_size return message -- cgit v1.2.3-70-g09d2