------------------------------------------------------------
revno: 1140
committer: Barry Warsaw <[EMAIL PROTECTED]>
branch nick: py26
timestamp: Mon 2008-12-01 23:25:33 -0500
message:
  Merge Mark's changes to complete the Python 2.6 compatibility.
modified:
  Mailman/Bouncers/Caiwireless.py
  Mailman/Bouncers/GroupWise.py
  Mailman/Bouncers/Microsoft.py
  Mailman/Bouncers/Netscape.py
  Mailman/Bouncers/Postfix.py
  Mailman/Handlers/Decorate.py
  Mailman/Handlers/Scrubber.py
  Mailman/Handlers/Tagger.py
  tests/test_handlers.py
  tests/test_message.py
    ------------------------------------------------------------
    revno: 1139.1.1
    committer: Mark Sapiro <[EMAIL PROTECTED]>
    branch nick: py26
    timestamp: Sun 2008-11-30 20:30:43 -0800
    message:
      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().
    modified:
      Mailman/Bouncers/Caiwireless.py
      Mailman/Bouncers/GroupWise.py
      Mailman/Bouncers/Microsoft.py
      Mailman/Bouncers/Netscape.py
      Mailman/Bouncers/Postfix.py
      Mailman/Handlers/Decorate.py
      Mailman/Handlers/Scrubber.py
      Mailman/Handlers/Tagger.py
      tests/test_handlers.py
      tests/test_message.py

=== modified file 'Mailman/Bouncers/Caiwireless.py'
--- a/Mailman/Bouncers/Caiwireless.py   2005-08-27 01:40:17 +0000
+++ b/Mailman/Bouncers/Caiwireless.py   2008-12-01 04:30:43 +0000
@@ -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 @@
 
 
 def process(msg):
-    if msg.get_type() <> 'multipart/mixed':
+    if msg.get_content_type() <> 'multipart/mixed':
         return None
     # simple state machine
     #     0 == nothing seen

=== modified file 'Mailman/Bouncers/GroupWise.py'
--- a/Mailman/Bouncers/GroupWise.py     2008-06-15 19:39:31 +0000
+++ b/Mailman/Bouncers/GroupWise.py     2008-12-01 04:30:43 +0000
@@ -30,7 +30,7 @@
 
 
 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 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

=== modified file 'Mailman/Bouncers/Microsoft.py'
--- a/Mailman/Bouncers/Microsoft.py     2005-08-27 01:40:17 +0000
+++ b/Mailman/Bouncers/Microsoft.py     2008-12-01 04:30:43 +0000
@@ -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 @@
 
 
 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:

=== modified file 'Mailman/Bouncers/Netscape.py'
--- a/Mailman/Bouncers/Netscape.py      2005-08-27 01:40:17 +0000
+++ b/Mailman/Bouncers/Netscape.py      2008-12-01 04:30:43 +0000
@@ -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 @@
     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:

=== modified file 'Mailman/Bouncers/Postfix.py'
--- a/Mailman/Bouncers/Postfix.py       2005-08-27 01:40:17 +0000
+++ b/Mailman/Bouncers/Postfix.py       2008-12-01 04:30:43 +0000
@@ -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 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)

=== modified file 'Mailman/Handlers/Decorate.py'
--- a/Mailman/Handlers/Decorate.py      2008-10-03 21:59:00 +0000
+++ b/Mailman/Handlers/Decorate.py      2008-12-01 04:30:43 +0000
@@ -130,7 +130,7 @@
             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()

=== modified file 'Mailman/Handlers/Scrubber.py'
--- a/Mailman/Handlers/Scrubber.py      2008-11-13 04:02:29 +0000
+++ b/Mailman/Handlers/Scrubber.py      2008-12-01 04:30:43 +0000
@@ -189,7 +189,7 @@
     # 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 @@
         # 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

=== modified file 'Mailman/Handlers/Tagger.py'
--- a/Mailman/Handlers/Tagger.py        2005-08-27 01:40:17 +0000
+++ b/Mailman/Handlers/Tagger.py        2008-12-01 04:30:43 +0000
@@ -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 @@
     # 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

=== modified file 'tests/test_handlers.py'
--- a/tests/test_handlers.py    2008-11-13 04:02:29 +0000
+++ b/tests/test_handlers.py    2008-12-01 04:30:43 +0000
@@ -133,7 +133,7 @@
         eq(str(str(qmsg['subject'])), '_xtest post acknowledgement')
         eq(qmsg['to'], '[EMAIL PROTECTED]')
         eq(qmsg['from'], '[EMAIL PROTECTED]')
-        eq(qmsg.get_type(), 'text/plain')
+        eq(qmsg.get_content_type(), 'text/plain')
         eq(qmsg.get_param('charset'), 'us-ascii')
         msgid = qmsg['message-id']
         self.failUnless(msgid.startswith('<mailman.'))
@@ -173,7 +173,7 @@
         eq(str(qmsg['subject']), '_xtest post acknowledgement')
         eq(qmsg['to'], '[EMAIL PROTECTED]')
         eq(qmsg['from'], '[EMAIL PROTECTED]')
-        eq(qmsg.get_type(), 'text/plain')
+        eq(qmsg.get_content_type(), 'text/plain')
         eq(qmsg.get_param('charset'), 'us-ascii')
         msgid = qmsg['message-id']
         self.failUnless(msgid.startswith('<mailman.'))
@@ -1168,7 +1168,7 @@
         MimeDel.process(self._mlist, msg, {})
         eq(len(msg.get_payload()), 1)
         subpart = msg.get_payload(0)
-        eq(subpart.get_type(), 'image/gif')
+        eq(subpart.get_content_type(), 'image/gif')
         eq(subpart.get_payload(), 'yyy')
 
     def test_collapse_multipart_alternative(self):
@@ -1199,9 +1199,9 @@
 """)
         MimeDel.process(self._mlist, msg, {})
         eq(len(msg.get_payload()), 1)
-        eq(msg.get_type(), 'multipart/mixed')
+        eq(msg.get_content_type(), 'multipart/mixed')
         subpart = msg.get_payload(0)
-        eq(subpart.get_type(), 'image/gif')
+        eq(subpart.get_content_type(), 'image/gif')
         eq(subpart.get_payload(), 'yyy')
 
     def test_convert_to_plaintext(self):
@@ -1216,7 +1216,7 @@
 <body></body></html>
 """)
         MimeDel.process(self._mlist, msg, {})
-        eq(msg.get_type(), 'text/plain')
+        eq(msg.get_content_type(), 'text/plain')
         eq(msg.get_payload(), '\n\n\n')
 
     def test_deep_structure(self):
@@ -1265,13 +1265,13 @@
         payload = msg.get_payload()
         eq(len(payload), 3)
         part1 = msg.get_payload(0)
-        eq(part1.get_type(), 'text/plain')
+        eq(part1.get_content_type(), 'text/plain')
         eq(part1.get_payload(), 'A different message')
         part2 = msg.get_payload(1)
-        eq(part2.get_type(), 'image/gif')
+        eq(part2.get_content_type(), 'image/gif')
         eq(part2.get_payload(), 'zzz')
         part3 = msg.get_payload(2)
-        eq(part3.get_type(), 'image/gif')
+        eq(part3.get_content_type(), 'image/gif')
         eq(part3.get_payload(), 'aaa')
 
     def test_top_multipart_alternative(self):
@@ -1292,7 +1292,7 @@
 --AAA--
 """)
         MimeDel.process(self._mlist, msg, {})
-        eq(msg.get_type(), 'text/plain')
+        eq(msg.get_content_type(), 'text/plain')
         eq(msg.get_payload(), 'This is plain text')
 
 

=== modified file 'tests/test_message.py'
--- a/tests/test_message.py     2005-08-27 01:40:17 +0000
+++ b/tests/test_message.py     2008-12-01 04:30:43 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2001 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
@@ -81,10 +81,10 @@
         # second message is the message/rfc822 attachment of the original
         # message.
         msg1 = qmsg.get_payload(0)
-        eq(msg1.get_type(), 'text/plain')
+        eq(msg1.get_content_type(), 'text/plain')
         eq(msg1.get_payload(), '[No bounce details are available]\n')
         msg2 = qmsg.get_payload(1)
-        eq(msg2.get_type(), 'message/rfc822')
+        eq(msg2.get_content_type(), 'message/rfc822')
         unless(not msg2.is_multipart())
         msg3 = msg2.get_payload()
         eq(msg3.get_payload(), 'yadda yadda yadda\n')



--
Stable, maintained release series
https://code.launchpad.net/~mailman-coders/mailman/2.1

You are receiving this branch notification because you are subscribed to it.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to