diff -r fe109a8386ce -r 525d38644e8d email/base64mime.py --- a/email/base64mime.py Fri Apr 25 16:04:20 2008 +0200 +++ b/email/base64mime.py Fri Apr 25 16:37:01 2008 +0200 @@ -20,7 +20,7 @@ This module does not do the line wrapping or end-of-line character conversion necessary for proper internationalized headers; it only does dumb encoding and -decoding. To deal with the various line wrapping issues, use the email.Header +decoding. To deal with the various line wrapping issues, use the email.header module. """ @@ -168,7 +168,7 @@ This function does not parse a full MIME header value encoded with base64 (like =?iso-8895-1?b?bmloISBuaWgh?=) -- please use the high - level email.Header class for that functionality. + level email.header class for that functionality. """ if not s: return s diff -r fe109a8386ce -r 525d38644e8d email/header.py --- a/email/header.py Fri Apr 25 16:04:20 2008 +0200 +++ b/email/header.py Fri Apr 25 16:37:01 2008 +0200 @@ -62,7 +62,7 @@ header, otherwise a lower-case string containing the name of the character set specified in the encoded string. - An email.Errors.HeaderParseError may be raised when certain decoding error + An email.errors.HeaderParseError may be raised when certain decoding error occurs (e.g. a base64 decoding exception). """ # If no encoding, just return the header @@ -337,8 +337,8 @@ # different charsets and/or encodings, and the resulting header will # accurately reflect each setting. # - # Each encoding can be email.Utils.QP (quoted-printable, for - # ASCII-like character sets like iso-8859-1), email.Utils.BASE64 + # Each encoding can be email.utils.QP (quoted-printable, for + # ASCII-like character sets like iso-8859-1), email.utils.BASE64 # (Base64, for non-ASCII like character sets like KOI8-R and # iso-2022-jp), or None (no encoding). # diff -r fe109a8386ce -r 525d38644e8d email/message.py --- a/email/message.py Fri Apr 25 16:04:20 2008 +0200 +++ b/email/message.py Fri Apr 25 16:37:01 2008 +0200 @@ -125,7 +125,7 @@ "From ". For more flexibility, use the flatten() method of a Generator instance. """ - from email.Generator import Generator + from email.generator import Generator fp = StringIO() g = Generator(fp) g.flatten(self, unixfrom=unixfrom) @@ -783,4 +783,4 @@ return [part.get_content_charset(failobj) for part in self.walk()] # I.e. def walk(self): ... - from email.Iterators import walk + from email.iterators import walk diff -r fe109a8386ce -r 525d38644e8d email/quoprimime.py --- a/email/quoprimime.py Fri Apr 25 16:04:20 2008 +0200 +++ b/email/quoprimime.py Fri Apr 25 16:37:01 2008 +0200 @@ -11,7 +11,7 @@ allowed in email bodies or headers. Quoted-printable is very space-inefficient for encoding binary files; use the -email.base64MIME module for that instead. +email.base64mime module for that instead. This module provides an interface to encode and decode both headers and bodies with quoted-printable encoding. @@ -23,7 +23,7 @@ This module does not do the line wrapping or end-of-line character conversion necessary for proper internationalized headers; it only does dumb encoding and decoding. To deal with the various line -wrapping issues, use the email.Header module. +wrapping issues, use the email.header module. """ __all__ = [ @@ -330,7 +330,7 @@ This function does not parse a full MIME header value encoded with quoted-printable (like =?iso-8895-1?q?Hello_World?=) -- please use - the high level email.Header class for that functionality. + the high level email.header class for that functionality. """ s = s.replace('_', ' ') return re.sub(r'=\w{2}', _unquote_match, s) diff -r fe109a8386ce -r 525d38644e8d email/test/test_email.py --- a/email/test/test_email.py Fri Apr 25 16:04:20 2008 +0200 +++ b/email/test/test_email.py Fri Apr 25 16:37:01 2008 +0200 @@ -13,17 +13,17 @@ import email -from email.Charset import Charset -from email.Header import Header, decode_header, make_header -from email.Parser import Parser, HeaderParser -from email.Generator import Generator, DecodedGenerator -from email.Message import Message -from email.MIMEAudio import MIMEAudio -from email.MIMEText import MIMEText -from email.MIMEImage import MIMEImage -from email.MIMEBase import MIMEBase -from email.MIMEMessage import MIMEMessage -from email.MIMEMultipart import MIMEMultipart +from email.charset import Charset +from email.header import Header, decode_header, make_header +from email.parser import Parser, HeaderParser +from email.generator import Generator, DecodedGenerator +from email.message import Message +from email.mime.audio import MIMEAudio +from email.mime.text import MIMEText +from email.mime.image import MIMEImage +from email.mime.base import MIMEBase +from email.mime.message import MIMEMessage +from email.mime.multipart import MIMEMultipart from email import Utils from email import Errors from email import Encoders @@ -511,7 +511,7 @@ -# Test the email.Encoders module +# Test the email.encoders module class TestEncoders(unittest.TestCase): def test_encode_empty_payload(self): eq = self.assertEqual diff -r fe109a8386ce -r 525d38644e8d email/test/test_email_codecs.py --- a/email/test/test_email_codecs.py Fri Apr 25 16:04:20 2008 +0200 +++ b/email/test/test_email_codecs.py Fri Apr 25 16:37:01 2008 +0200 @@ -6,9 +6,9 @@ from test.test_support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase -from email.Charset import Charset -from email.Header import Header, decode_header -from email.Message import Message +from email.charset import Charset +from email.header import Header, decode_header +from email.message import Message # We're compatible with Python 2.3, but it doesn't have the built-in Asian # codecs, so we have to skip all these tests. diff -r fe109a8386ce -r 525d38644e8d email/test/test_email_torture.py --- a/email/test/test_email_torture.py Fri Apr 25 16:04:20 2008 +0200 +++ b/email/test/test_email_torture.py Fri Apr 25 16:37:01 2008 +0200 @@ -17,7 +17,7 @@ import email from email import __file__ as testfile -from email.Iterators import _structure +from email.iterators import _structure def openfile(filename): from os.path import join, dirname, abspath diff -r fe109a8386ce -r 525d38644e8d logging/handlers.py --- a/logging/handlers.py Fri Apr 25 16:04:20 2008 +0200 +++ b/logging/handlers.py Fri Apr 25 16:37:01 2008 +0200 @@ -733,7 +733,7 @@ try: import smtplib try: - from email.Utils import formatdate + from email.utils import formatdate except: formatdate = self.date_time port = self.mailport diff -r fe109a8386ce -r 525d38644e8d mailbox.py --- a/mailbox.py Fri Apr 25 16:04:20 2008 +0200 +++ b/mailbox.py Fri Apr 25 16:37:01 2008 +0200 @@ -16,8 +16,8 @@ import errno import copy import email -import email.Message -import email.Generator +import email.message +import email.generator import rfc822 import StringIO try: @@ -194,11 +194,11 @@ def _dump_message(self, message, target, mangle_from_=False): # Most files are opened in binary mode to allow predictable seeking. # To get native line endings on disk, the user-friendly \n line endings - # used in strings and by email.Message are translated here. + # used in strings and by email.message are translated here. """Dump message contents to target file.""" - if isinstance(message, email.Message.Message): + if isinstance(message, email.message.Message): buffer = StringIO.StringIO() - gen = email.Generator.Generator(buffer, mangle_from_, 0) + gen = email.generator.Generator(buffer, mangle_from_, 0) gen.flatten(message) buffer.seek(0) target.write(buffer.read().replace('\n', os.linesep)) @@ -691,7 +691,7 @@ message = '' elif isinstance(message, _mboxMMDFMessage): from_line = 'From ' + message.get_from() - elif isinstance(message, email.Message.Message): + elif isinstance(message, email.message.Message): from_line = message.get_unixfrom() # May be None. if from_line is None: from_line = 'From MAILER-DAEMON %s' % time.asctime(time.gmtime()) @@ -1236,9 +1236,9 @@ self._file.write(os.linesep) else: self._file.write('1,,' + os.linesep) - if isinstance(message, email.Message.Message): + if isinstance(message, email.message.Message): orig_buffer = StringIO.StringIO() - orig_generator = email.Generator.Generator(orig_buffer, False, 0) + orig_generator = email.generator.Generator(orig_buffer, False, 0) orig_generator.flatten(message) orig_buffer.seek(0) while True: @@ -1249,7 +1249,7 @@ self._file.write('*** EOOH ***' + os.linesep) if isinstance(message, BabylMessage): vis_buffer = StringIO.StringIO() - vis_generator = email.Generator.Generator(vis_buffer, False, 0) + vis_generator = email.generator.Generator(vis_buffer, False, 0) vis_generator.flatten(message.get_visible()) while True: line = vis_buffer.readline() @@ -1305,12 +1305,12 @@ return (start, stop) -class Message(email.Message.Message): +class Message(email.message.Message): """Message with mailbox-format-specific properties.""" def __init__(self, message=None): """Initialize a Message instance.""" - if isinstance(message, email.Message.Message): + if isinstance(message, email.message.Message): self._become_message(copy.deepcopy(message)) if isinstance(message, Message): message._explain_to(self) @@ -1319,7 +1319,7 @@ elif hasattr(message, "read"): self._become_message(email.message_from_file(message)) elif message is None: - email.Message.Message.__init__(self) + email.message.Message.__init__(self) else: raise TypeError('Invalid message type: %s' % type(message)) @@ -1450,7 +1450,7 @@ def __init__(self, message=None): """Initialize an mboxMMDFMessage instance.""" self.set_from('MAILER-DAEMON', True) - if isinstance(message, email.Message.Message): + if isinstance(message, email.message.Message): unixfrom = message.get_unixfrom() if unixfrom is not None and unixfrom.startswith('From '): self.set_from(unixfrom[5:]) diff -r fe109a8386ce -r 525d38644e8d smtplib.py --- a/smtplib.py Fri Apr 25 16:04:20 2008 +0200 +++ b/smtplib.py Fri Apr 25 16:37:01 2008 +0200 @@ -43,10 +43,10 @@ import socket import re -import email.Utils +import email.utils import base64 import hmac -from email.base64MIME import encode as encode_base64 +from email.base64mime import encode as encode_base64 from sys import stderr __all__ = ["SMTPException","SMTPServerDisconnected","SMTPResponseException", @@ -171,7 +171,7 @@ """ m = (None, None) try: - m = email.Utils.parseaddr(addr)[1] + m = email.utils.parseaddr(addr)[1] except AttributeError: pass if m == (None, None): # Indicates parse failure or AttributeError diff -r fe109a8386ce -r 525d38644e8d test/test_mailbox.py --- a/test/test_mailbox.py Fri Apr 25 16:04:20 2008 +0200 +++ b/test/test_mailbox.py Fri Apr 25 16:37:01 2008 +0200 @@ -4,7 +4,7 @@ import stat import socket import email -import email.Message +import email.message import rfc822 import re import StringIO @@ -22,7 +22,7 @@ def _check_sample(self, msg): # Inspect a mailbox.Message representation of the sample message - self.assert_(isinstance(msg, email.Message.Message)) + self.assert_(isinstance(msg, email.message.Message)) self.assert_(isinstance(msg, mailbox.Message)) for key, value in _sample_headers.iteritems(): self.assert_(value in msg.get_all(key)) @@ -30,7 +30,7 @@ self.assert_(len(msg.get_payload()) == len(_sample_payloads)) for i, payload in enumerate(_sample_payloads): part = msg.get_payload(i) - self.assert_(isinstance(part, email.Message.Message)) + self.assert_(isinstance(part, email.message.Message)) self.assert_(not isinstance(part, mailbox.Message)) self.assert_(part.get_payload() == payload) @@ -946,7 +946,7 @@ self._delete_recursively(self._path) def test_initialize_with_eMM(self): - # Initialize based on email.Message.Message instance + # Initialize based on email.message.Message instance eMM = email.message_from_string(_sample_message) msg = self._factory(eMM) self._post_initialize_hook(msg) @@ -972,7 +972,7 @@ # Initialize without arguments msg = self._factory() self._post_initialize_hook(msg) - self.assert_(isinstance(msg, email.Message.Message)) + self.assert_(isinstance(msg, email.message.Message)) self.assert_(isinstance(msg, mailbox.Message)) self.assert_(isinstance(msg, self._factory)) self.assert_(msg.keys() == []) @@ -999,7 +999,7 @@ mailbox.BabylMessage, mailbox.MMDFMessage): other_msg = class_() msg._explain_to(other_msg) - other_msg = email.Message.Message() + other_msg = email.message.Message() self.assertRaises(TypeError, lambda: msg._explain_to(other_msg)) def _post_initialize_hook(self, msg): @@ -1739,11 +1739,11 @@ def test_unix_mbox(self): ### should be better! - import email.Parser + import email.parser fname = self.createMessage("cur", True) n = 0 for msg in mailbox.PortableUnixMailbox(open(fname), - email.Parser.Parser().parse): + email.parser.Parser().parse): n += 1 self.assertEqual(msg["subject"], "Simple Test") self.assertEqual(len(str(msg)), len(FROM_)+len(DUMMY_MESSAGE)) diff -r fe109a8386ce -r 525d38644e8d test/test_old_mailbox.py --- a/test/test_old_mailbox.py Fri Apr 25 16:04:20 2008 +0200 +++ b/test/test_old_mailbox.py Fri Apr 25 16:37:01 2008 +0200 @@ -99,11 +99,11 @@ def test_unix_mbox(self): ### should be better! - import email.Parser + import email.parser fname = self.createMessage("cur", True) n = 0 for msg in mailbox.PortableUnixMailbox(open(fname), - email.Parser.Parser().parse): + email.parser.Parser().parse): n += 1 self.assertEqual(msg["subject"], "Simple Test") self.assertEqual(len(str(msg)), len(FROM_)+len(DUMMY_MESSAGE)) diff -r fe109a8386ce -r 525d38644e8d urllib.py --- a/urllib.py Fri Apr 25 16:04:20 2008 +0200 +++ b/urllib.py Fri Apr 25 16:37:01 2008 +0200 @@ -460,7 +460,7 @@ def open_local_file(self, url): """Use local file.""" - import mimetypes, mimetools, email.Utils + import mimetypes, mimetools, email.utils try: from cStringIO import StringIO except ImportError: @@ -472,7 +472,7 @@ except OSError, e: raise IOError(e.errno, e.strerror, e.filename) size = stats.st_size - modified = email.Utils.formatdate(stats.st_mtime, usegmt=True) + modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO( 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % diff -r fe109a8386ce -r 525d38644e8d urllib2.py --- a/urllib2.py Fri Apr 25 16:04:20 2008 +0200 +++ b/urllib2.py Fri Apr 25 16:37:01 2008 +0200 @@ -1208,14 +1208,14 @@ # not entirely sure what the rules are here def open_local_file(self, req): - import email.Utils + import email.utils import mimetypes host = req.get_host() file = req.get_selector() localfile = url2pathname(file) stats = os.stat(localfile) size = stats.st_size - modified = email.Utils.formatdate(stats.st_mtime, usegmt=True) + modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(file)[0] headers = mimetools.Message(StringIO( 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' % diff -r fe109a8386ce -r 525d38644e8d wsgiref/headers.py --- a/wsgiref/headers.py Fri Apr 25 16:04:20 2008 +0200 +++ b/wsgiref/headers.py Fri Apr 25 16:37:01 2008 +0200 @@ -1,6 +1,6 @@ """Manage HTTP Response Headers -Much of this module is red-handedly pilfered from email.Message in the stdlib, +Much of this module is red-handedly pilfered from email.message in the stdlib, so portions are Copyright (C) 2001,2002 Python Software Foundation, and were written by Barry Warsaw. """ @@ -174,7 +174,7 @@ h.add_header('content-disposition', 'attachment', filename='bud.gif') - Note that unlike the corresponding 'email.Message' method, this does + Note that unlike the corresponding 'email.message' method, this does *not* handle '(charset, language, value)' tuples: all values must be strings or None. """