[Python-3000-checkins] r64204 - in python/branches/py3k: Lib/http/server.py Lib/smtplib.py Lib/test/test_pyclbr.py Tools/faqwiz/faqwiz.py Tools/scripts/mailerdaemon.py Tools/versioncheck/pyversioncheck.py

georg.brandl python-3000-checkins at python.org
Fri Jun 13 00:23:59 CEST 2008


Author: georg.brandl
Date: Fri Jun 13 00:23:59 2008
New Revision: 64204

Log:
Remove traces of rfc822.


Modified:
   python/branches/py3k/Lib/http/server.py
   python/branches/py3k/Lib/smtplib.py
   python/branches/py3k/Lib/test/test_pyclbr.py
   python/branches/py3k/Tools/faqwiz/faqwiz.py
   python/branches/py3k/Tools/scripts/mailerdaemon.py
   python/branches/py3k/Tools/versioncheck/pyversioncheck.py

Modified: python/branches/py3k/Lib/http/server.py
==============================================================================
--- python/branches/py3k/Lib/http/server.py	(original)
+++ python/branches/py3k/Lib/http/server.py	Fri Jun 13 00:23:59 2008
@@ -315,7 +315,7 @@
 
         # Examine the headers and look for a Connection directive.
 
-        # MessageClass (rfc822) wants to see strings rather than bytes.
+        # MessageClass wants to see strings rather than bytes.
         # But a TextIOWrapper around self.rfile would buffer too many bytes
         # from the stream, bytes which we later need to read as bytes.
         # So we read the correct bytes here, as bytes, then use StringIO

Modified: python/branches/py3k/Lib/smtplib.py
==============================================================================
--- python/branches/py3k/Lib/smtplib.py	(original)
+++ python/branches/py3k/Lib/smtplib.py	Fri Jun 13 00:23:59 2008
@@ -131,7 +131,7 @@
 def quoteaddr(addr):
     """Quote a subset of the email addresses defined by RFC 821.
 
-    Should be able to handle anything rfc822.parseaddr can handle.
+    Should be able to handle anything email.utils.parseaddr can handle.
     """
     m = (None, None)
     try:

Modified: python/branches/py3k/Lib/test/test_pyclbr.py
==============================================================================
--- python/branches/py3k/Lib/test/test_pyclbr.py	(original)
+++ python/branches/py3k/Lib/test/test_pyclbr.py	Fri Jun 13 00:23:59 2008
@@ -140,6 +140,7 @@
 
     def test_easy(self):
         self.checkModule('pyclbr')
+        self.checkModule('ast')
         self.checkModule('doctest', ignore=("TestResults", "_SpoofOut"))
         self.checkModule('difflib', ignore=("Match",))
 

Modified: python/branches/py3k/Tools/faqwiz/faqwiz.py
==============================================================================
--- python/branches/py3k/Tools/faqwiz/faqwiz.py	(original)
+++ python/branches/py3k/Tools/faqwiz/faqwiz.py	Fri Jun 13 00:23:59 2008
@@ -207,8 +207,8 @@
         self.file = file
         self.sec, self.num = sec_num
         if fp:
-            import rfc822
-            self.__headers = rfc822.Message(fp)
+            import email
+            self.__headers = email.message_from_file(fp)
             self.body = fp.read().strip()
         else:
             self.__headers = {'title': "%d.%d. " % sec_num}

Modified: python/branches/py3k/Tools/scripts/mailerdaemon.py
==============================================================================
--- python/branches/py3k/Tools/scripts/mailerdaemon.py	(original)
+++ python/branches/py3k/Tools/scripts/mailerdaemon.py	Fri Jun 13 00:23:59 2008
@@ -1,16 +1,16 @@
 """mailerdaemon - classes to parse mailer-daemon messages"""
 
-import rfc822
 import calendar
+import email.message
 import re
 import os
 import sys
 
 Unparseable = 'mailerdaemon.Unparseable'
 
-class ErrorMessage(rfc822.Message):
-    def __init__(self, fp):
-        rfc822.Message.__init__(self, fp)
+class ErrorMessage(email.message.Message):
+    def __init__(self):
+        email.message.Message.__init__(self)
         self.sub = ''
 
     def is_warning(self):
@@ -169,7 +169,7 @@
     for fn in files:
         # Lets try to parse the file.
         fp = open(fn)
-        m = ErrorMessage(fp)
+        m = email.message_from_file(fp, _class=ErrorMessage)
         sender = m.getaddr('From')
         print('%s\t%-40s\t'%(fn, sender[1]), end=' ')
 

Modified: python/branches/py3k/Tools/versioncheck/pyversioncheck.py
==============================================================================
--- python/branches/py3k/Tools/versioncheck/pyversioncheck.py	(original)
+++ python/branches/py3k/Tools/versioncheck/pyversioncheck.py	Fri Jun 13 00:23:59 2008
@@ -1,6 +1,6 @@
 """pyversioncheck - Module to help with checking versions"""
-import rfc822
 import urllib
+import email
 import sys
 
 # Verbose options
@@ -52,7 +52,7 @@
         if verbose >= VERBOSE_EACHFILE:
             print('    Cannot open:', arg)
         return -1, None, None
-    msg = rfc822.Message(fp, seekable=0)
+    msg = email.message_from_file(fp)
     newversion = msg.get('current-version')
     if not newversion:
         if verbose >= VERBOSE_EACHFILE:


More information about the Python-3000-checkins mailing list