diff options
| author | Barry Warsaw | 2012-10-31 17:31:12 +0100 |
|---|---|---|
| committer | Barry Warsaw | 2012-10-31 17:31:12 +0100 |
| commit | a9464c14fc6dfc23613a1ec89446393fe6476f88 (patch) | |
| tree | 74a926cfe64066ebffcf9adb89e7672289173d84 /src/mailman/testing/helpers.py | |
| parent | a1666479d87e26e5c79dd1cf507b8ef0472c59aa (diff) | |
| download | mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.tar.gz mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.tar.zst mailman-a9464c14fc6dfc23613a1ec89446393fe6476f88.zip | |
Diffstat (limited to 'src/mailman/testing/helpers.py')
| -rw-r--r-- | src/mailman/testing/helpers.py | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py index 054dd4ff7..99f4b8961 100644 --- a/src/mailman/testing/helpers.py +++ b/src/mailman/testing/helpers.py @@ -249,8 +249,8 @@ def get_lmtp_client(quiet=False): if not quiet: print(response) return lmtp - except socket.error as error: - if error[0] == errno.ECONNREFUSED: + except IOError as error: + if error.errno == errno.ECONNREFUSED: time.sleep(0.1) else: raise @@ -284,8 +284,8 @@ def wait_for_webservice(): try: socket.socket().connect((config.webservice.hostname, int(config.webservice.port))) - except socket.error as error: - if error[0] == errno.ECONNREFUSED: + except IOError as error: + if error.errno == errno.ECONNREFUSED: time.sleep(0.1) else: raise @@ -515,19 +515,3 @@ class LogFileMark: with open(self._filename) as fp: fp.seek(self._filepos) return fp.readline() - - - -# In Python 2.6, body_line_iterator() uses a cStringIO.StringIO() which cannot -# handle unicode. In Python 2.7 this works fine. I hate version checks but -# this is the easiest way to handle it. OTOH, we could just use the manual -# way for all Python versions instead. -import sys -if sys.hexversion >= 0x2070000: - from email.iterators import body_line_iterator -else: - def body_line_iterator(msg, decode=False): - payload = msg.get_payload(decode=decode) - bytes_payload = payload.encode('utf-8') - for line in bytes_payload.splitlines(): - yield line |
