Remove traces of rfc822.

This commit is contained in:
Georg Brandl 2008-06-12 22:23:59 +00:00
parent a0c0a4a261
commit 9f0f960d4c
6 changed files with 12 additions and 11 deletions

View file

@ -315,7 +315,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
# Examine the headers and look for a Connection directive. # 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 # But a TextIOWrapper around self.rfile would buffer too many bytes
# from the stream, bytes which we later need to read as 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 # So we read the correct bytes here, as bytes, then use StringIO

View file

@ -131,7 +131,7 @@ class SMTPAuthenticationError(SMTPResponseException):
def quoteaddr(addr): def quoteaddr(addr):
"""Quote a subset of the email addresses defined by RFC 821. """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) m = (None, None)
try: try:

View file

@ -140,6 +140,7 @@ class PyclbrTest(TestCase):
def test_easy(self): def test_easy(self):
self.checkModule('pyclbr') self.checkModule('pyclbr')
self.checkModule('ast')
self.checkModule('doctest', ignore=("TestResults", "_SpoofOut")) self.checkModule('doctest', ignore=("TestResults", "_SpoofOut"))
self.checkModule('difflib', ignore=("Match",)) self.checkModule('difflib', ignore=("Match",))

View file

@ -207,8 +207,8 @@ class FaqEntry:
self.file = file self.file = file
self.sec, self.num = sec_num self.sec, self.num = sec_num
if fp: if fp:
import rfc822 import email
self.__headers = rfc822.Message(fp) self.__headers = email.message_from_file(fp)
self.body = fp.read().strip() self.body = fp.read().strip()
else: else:
self.__headers = {'title': "%d.%d. " % sec_num} self.__headers = {'title': "%d.%d. " % sec_num}

View file

@ -1,16 +1,16 @@
"""mailerdaemon - classes to parse mailer-daemon messages""" """mailerdaemon - classes to parse mailer-daemon messages"""
import rfc822
import calendar import calendar
import email.message
import re import re
import os import os
import sys import sys
Unparseable = 'mailerdaemon.Unparseable' Unparseable = 'mailerdaemon.Unparseable'
class ErrorMessage(rfc822.Message): class ErrorMessage(email.message.Message):
def __init__(self, fp): def __init__(self):
rfc822.Message.__init__(self, fp) email.message.Message.__init__(self)
self.sub = '' self.sub = ''
def is_warning(self): def is_warning(self):
@ -169,7 +169,7 @@ def parsedir(dir, modify):
for fn in files: for fn in files:
# Lets try to parse the file. # Lets try to parse the file.
fp = open(fn) fp = open(fn)
m = ErrorMessage(fp) m = email.message_from_file(fp, _class=ErrorMessage)
sender = m.getaddr('From') sender = m.getaddr('From')
print('%s\t%-40s\t'%(fn, sender[1]), end=' ') print('%s\t%-40s\t'%(fn, sender[1]), end=' ')

View file

@ -1,6 +1,6 @@
"""pyversioncheck - Module to help with checking versions""" """pyversioncheck - Module to help with checking versions"""
import rfc822
import urllib import urllib
import email
import sys import sys
# Verbose options # Verbose options
@ -52,7 +52,7 @@ def _check1version(package, url, version, verbose=0):
if verbose >= VERBOSE_EACHFILE: if verbose >= VERBOSE_EACHFILE:
print(' Cannot open:', arg) print(' Cannot open:', arg)
return -1, None, None return -1, None, None
msg = rfc822.Message(fp, seekable=0) msg = email.message_from_file(fp)
newversion = msg.get('current-version') newversion = msg.get('current-version')
if not newversion: if not newversion:
if verbose >= VERBOSE_EACHFILE: if verbose >= VERBOSE_EACHFILE: