summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-10-09 21:36:35 +0000
committerbwarsaw2001-10-09 21:36:35 +0000
commitf1c6bf4adc953e0355c7c8f0dc156f3368008a0a (patch)
treef5b69e3c9b5ec94b992b88ca6f7221246931a48c
parent0409119d44f36229c63b0be08baa9962f279b6bb (diff)
downloadmailman-f1c6bf4adc953e0355c7c8f0dc156f3368008a0a.tar.gz
mailman-f1c6bf4adc953e0355c7c8f0dc156f3368008a0a.tar.zst
mailman-f1c6bf4adc953e0355c7c8f0dc156f3368008a0a.zip
process(): Convert from the mimelib API to the email package API.
-rw-r--r--Mailman/Bouncers/Caiwireless.py10
-rw-r--r--Mailman/Bouncers/Compuserve.py6
-rw-r--r--Mailman/Bouncers/Exim.py3
-rw-r--r--Mailman/Bouncers/Microsoft.py2
-rw-r--r--Mailman/Bouncers/Netscape.py8
-rw-r--r--Mailman/Bouncers/Yahoo.py6
6 files changed, 12 insertions, 23 deletions
diff --git a/Mailman/Bouncers/Caiwireless.py b/Mailman/Bouncers/Caiwireless.py
index bc5ad070c..9c9fec1bd 100644
--- a/Mailman/Bouncers/Caiwireless.py
+++ b/Mailman/Bouncers/Caiwireless.py
@@ -27,18 +27,14 @@ acre = re.compile(r'<(?P<addr>[^>]*)>')
def process(msg):
- if msg.gettype() <> 'multipart/mixed':
+ if msg.get_type() <> 'multipart/mixed':
return None
- # This format thinks it's a MIME, but it really isn't
- mi = email.Iterators.body_line_iterator(msg)
# simple state machine
# 0 == nothing seen
# 1 == tag line seen
state = 0
- while 1:
- line = mi.readline()
- if not line:
- return None
+ # This format thinks it's a MIME, but it really isn't
+ for line in email.Iterators.body_line_iterator(msg):
line = line.strip()
if state == 0 and tcre.match(line):
state = 1
diff --git a/Mailman/Bouncers/Compuserve.py b/Mailman/Bouncers/Compuserve.py
index b2f074725..9f993e8d5 100644
--- a/Mailman/Bouncers/Compuserve.py
+++ b/Mailman/Bouncers/Compuserve.py
@@ -25,16 +25,12 @@ acre = re.compile(r'Invalid receiver address: (?P<addr>.*)')
def process(msg):
- mi = email.Iterators.body_line_iterator(msg)
# simple state machine
# 0 = nothing seen yet
# 1 = intro line seen
state = 0
addrs = []
- while 1:
- line = mi.readline()
- if not line:
- break
+ for line in email.Iterators.body_line_iterator(msg):
if state == 0:
mo = dcre.search(line)
if mo:
diff --git a/Mailman/Bouncers/Exim.py b/Mailman/Bouncers/Exim.py
index 29fed39fb..5d55a952a 100644
--- a/Mailman/Bouncers/Exim.py
+++ b/Mailman/Bouncers/Exim.py
@@ -26,4 +26,5 @@ from email.Utils import getaddresses
def process(msg):
- return [a for n, a in getaddresses(msg.getall('x-failed-recipients'))]
+ all = msg.get_all('x-failed-recipients', [])
+ return [a for n, a in getaddresses(all)]
diff --git a/Mailman/Bouncers/Microsoft.py b/Mailman/Bouncers/Microsoft.py
index b34f0a2cd..067d21639 100644
--- a/Mailman/Bouncers/Microsoft.py
+++ b/Mailman/Bouncers/Microsoft.py
@@ -24,7 +24,7 @@ scre = re.compile(r'transcript of session follows', re.IGNORECASE)
def process(msg):
- if msg.gettype() <> 'multipart/mixed':
+ if msg.get_type() <> 'multipart/mixed':
return None
# Find the first subpart, which has no MIME type
try:
diff --git a/Mailman/Bouncers/Netscape.py b/Mailman/Bouncers/Netscape.py
index 611f8ac78..65a73c1ab 100644
--- a/Mailman/Bouncers/Netscape.py
+++ b/Mailman/Bouncers/Netscape.py
@@ -40,7 +40,7 @@ acre = re.compile(
def flatten(msg, leaves):
# give us all the leaf (non-multipart) subparts
- if msg.ismultipart():
+ if msg.is_multipart():
for part in msg.get_payload():
flatten(part, leaves)
else:
@@ -53,7 +53,7 @@ def process(msg):
# multipart/report; report-type=delivery-status
# and some show
# multipart/mixed;
- if not msg.ismultipart():
+ if not msg.is_multipart():
return None
# We're looking for a text/plain subpart occuring before a
# message/delivery-status subpart.
@@ -61,8 +61,8 @@ def process(msg):
leaves = []
flatten(msg, leaves)
for i, subpart in zip(range(len(leaves)-1), leaves):
- if subpart.gettype() == 'text/plain' and \
- leaves[i+1].getmaintype() == 'message':
+ if subpart.get_type() == 'text/plain' and \
+ leaves[i+1].get_main_type() == 'message':
plainmsg = subpart
break
if not plainmsg:
diff --git a/Mailman/Bouncers/Yahoo.py b/Mailman/Bouncers/Yahoo.py
index aed1ea668..8132918bb 100644
--- a/Mailman/Bouncers/Yahoo.py
+++ b/Mailman/Bouncers/Yahoo.py
@@ -30,16 +30,12 @@ def process(msg):
# an x-uidl: header, the value of which seems unimportant.
if msg.get('from', '').lower() <> 'mailer-daemon@yahoo.com':
return None
- mi = email.Iterators.body_line_iterator(msg)
addrs = []
# simple state machine
# 0 == nothing seen
# 1 == tag line seen
state = 0
- while 1:
- line = mi.readline()
- if not line:
- break
+ for line in email.Iterators.body_line_iterator(msg):
line = line.strip()
if state == 0 and tcre.match(line):
state = 1