aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2008-11-30 20:30:43 -0800
committerMark Sapiro <mark@msapiro.net>2008-11-30 20:30:43 -0800
commitf579d5c290b80e00974e8c034f9d6dd697fcdfa6 (patch)
tree7ad0054577c7e457a94ecec5cd55d0003c2c2f08 /Mailman
parent0e6f7c1fc99eb7e35c23695bca2c17e757baf514 (diff)
downloadmailman2-f579d5c290b80e00974e8c034f9d6dd697fcdfa6.tar.gz
mailman2-f579d5c290b80e00974e8c034f9d6dd697fcdfa6.tar.xz
mailman2-f579d5c290b80e00974e8c034f9d6dd697fcdfa6.zip
Now that Python 2.4 is the minimum and we will use more recent installed
email packages, convert all the email message get_type() calls to get_content_type().
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/Bouncers/Caiwireless.py4
-rw-r--r--Mailman/Bouncers/GroupWise.py4
-rw-r--r--Mailman/Bouncers/Microsoft.py4
-rw-r--r--Mailman/Bouncers/Netscape.py4
-rw-r--r--Mailman/Bouncers/Postfix.py6
-rw-r--r--Mailman/Handlers/Decorate.py2
-rw-r--r--Mailman/Handlers/Scrubber.py4
-rw-r--r--Mailman/Handlers/Tagger.py9
8 files changed, 19 insertions, 18 deletions
diff --git a/Mailman/Bouncers/Caiwireless.py b/Mailman/Bouncers/Caiwireless.py
index e2909122..b71b0624 100644
--- a/Mailman/Bouncers/Caiwireless.py
+++ b/Mailman/Bouncers/Caiwireless.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -27,7 +27,7 @@ acre = re.compile(r'<(?P<addr>[^>]*)>')
def process(msg):
- if msg.get_type() <> 'multipart/mixed':
+ if msg.get_content_type() <> 'multipart/mixed':
return None
# simple state machine
# 0 == nothing seen
diff --git a/Mailman/Bouncers/GroupWise.py b/Mailman/Bouncers/GroupWise.py
index 74116135..e5122f73 100644
--- a/Mailman/Bouncers/GroupWise.py
+++ b/Mailman/Bouncers/GroupWise.py
@@ -30,7 +30,7 @@ acre = re.compile(r'<(?P<addr>[^>]*)>')
def find_textplain(msg):
- if msg.get_type(msg.get_default_type()) == 'text/plain':
+ if msg.get_content_type() == 'text/plain':
return msg
if msg.is_multipart:
for part in msg.get_payload():
@@ -44,7 +44,7 @@ def find_textplain(msg):
def process(msg):
- if msg.get_type() <> 'multipart/mixed' or not msg['x-mailer']:
+ if msg.get_content_type() <> 'multipart/mixed' or not msg['x-mailer']:
return None
if msg['x-mailer'][:3].lower() not in ('nov', 'ntm', 'int'):
return None
diff --git a/Mailman/Bouncers/Microsoft.py b/Mailman/Bouncers/Microsoft.py
index d8a90b24..fec7cc93 100644
--- a/Mailman/Bouncers/Microsoft.py
+++ b/Mailman/Bouncers/Microsoft.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -25,7 +25,7 @@ scre = re.compile(r'transcript of session follows', re.IGNORECASE)
def process(msg):
- if msg.get_type() <> 'multipart/mixed':
+ if msg.get_content_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 f5974602..8c21f629 100644
--- a/Mailman/Bouncers/Netscape.py
+++ b/Mailman/Bouncers/Netscape.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -61,7 +61,7 @@ def process(msg):
leaves = []
flatten(msg, leaves)
for i, subpart in zip(range(len(leaves)-1), leaves):
- if subpart.get_type() == 'text/plain':
+ if subpart.get_content_type() == 'text/plain':
plainmsg = subpart
break
if not plainmsg:
diff --git a/Mailman/Bouncers/Postfix.py b/Mailman/Bouncers/Postfix.py
index 1fab8666..3c250e95 100644
--- a/Mailman/Bouncers/Postfix.py
+++ b/Mailman/Bouncers/Postfix.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -71,14 +71,14 @@ def findaddr(msg):
def process(msg):
- if msg.get_type() not in ('multipart/mixed', 'multipart/report'):
+ if msg.get_content_type() not in ('multipart/mixed', 'multipart/report'):
return None
# We're looking for the plain/text subpart with a Content-Description: of
# `notification'.
leaves = []
flatten(msg, leaves)
for subpart in leaves:
- if subpart.get_type() == 'text/plain' and \
+ if subpart.get_content_type() == 'text/plain' and \
subpart.get('content-description', '').lower() == 'notification':
# then...
return findaddr(subpart)
diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py
index 81bf7d33..fa6c3a80 100644
--- a/Mailman/Handlers/Decorate.py
+++ b/Mailman/Handlers/Decorate.py
@@ -130,7 +130,7 @@ def process(mlist, msg, msgdata):
wrap = False
except (LookupError, UnicodeError):
pass
- elif msg.get_type() == 'multipart/mixed':
+ elif msg.get_content_type() == 'multipart/mixed':
# The next easiest thing to do is just prepend the header and append
# the footer as additional subparts
payload = msg.get_payload()
diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py
index 7f42e5ed..32ba0403 100644
--- a/Mailman/Handlers/Scrubber.py
+++ b/Mailman/Handlers/Scrubber.py
@@ -189,7 +189,7 @@ def process(mlist, msg, msgdata=None):
# Now walk over all subparts of this message and scrub out various types
format = delsp = None
for part in msg.walk():
- ctype = part.get_type(part.get_default_type())
+ ctype = part.get_content_type()
# If the part is text/plain, we leave it alone
if ctype == 'text/plain':
# We need to choose a charset for the scrubbed message, so we'll
@@ -300,7 +300,7 @@ URL: %(url)s
# will transform the url into a hyperlink.
elif part.get_payload() and not part.is_multipart():
payload = part.get_payload(decode=True)
- ctype = part.get_type()
+ ctype = part.get_content_type()
# XXX Under email 2.5, it is possible that payload will be None.
# This can happen when you have a Content-Type: multipart/* with
# only one part and that part has two blank lines between the
diff --git a/Mailman/Handlers/Tagger.py b/Mailman/Handlers/Tagger.py
index 65ead7f6..0d3ce497 100644
--- a/Mailman/Handlers/Tagger.py
+++ b/Mailman/Handlers/Tagger.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2008 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -69,11 +69,12 @@ def scanbody(msg, numlines=None):
# or if the outer type is multipart/alternative and there is a text/plain
# part. Anything else, and the body is ignored for header-scan purposes.
found = None
- if msg.get_type('text/plain') == 'text/plain':
+ if msg.get_content_type() == 'text/plain':
found = msg
- elif msg.is_multipart() and msg.get_type() == 'multipart/alternative':
+ elif (msg.is_multipart() and
+ msg.get_content_type() == 'multipart/alternative'):
for found in msg.get_payload():
- if found.get_type('text/plain') == 'text/plain':
+ if found.get_content_type() == 'text/plain':
break
else:
found = None