summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-06-02 19:05:08 (GMT)
committerBarry Warsaw <barry@python.org>2002-06-02 19:05:08 (GMT)
commit524af6f382d1d287763018abc7c6415bb3dad9b5 (patch)
tree4ffc8af7c52b7b82e0d9038852e2c9b81544f01a /Lib/email
parent7dc865ad726d27a263143865bda59c1a70fde0db (diff)
downloadcpython-524af6f382d1d287763018abc7c6415bb3dad9b5.zip
cpython-524af6f382d1d287763018abc7c6415bb3dad9b5.tar.gz
cpython-524af6f382d1d287763018abc7c6415bb3dad9b5.tar.bz2
Use absolute import paths for intrapackage imports.
Use MIMENonMultipart as the base class so that you can't attach() to these non-multipart message types.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/MIMEAudio.py10
-rw-r--r--Lib/email/MIMEBase.py2
-rw-r--r--Lib/email/MIMEImage.py11
-rw-r--r--Lib/email/MIMEMessage.py12
-rw-r--r--Lib/email/MIMEText.py10
5 files changed, 23 insertions, 22 deletions
diff --git a/Lib/email/MIMEAudio.py b/Lib/email/MIMEAudio.py
index 57b7b6d..be8599b 100644
--- a/Lib/email/MIMEAudio.py
+++ b/Lib/email/MIMEAudio.py
@@ -6,9 +6,9 @@
import sndhdr
from cStringIO import StringIO
-import MIMEBase
-import Errors
-import Encoders
+from email import Errors
+from email import Encoders
+from email.MIMENonMultipart import MIMENonMultipart
@@ -37,7 +37,7 @@ def _whatsnd(data):
-class MIMEAudio(MIMEBase.MIMEBase):
+class MIMEAudio(MIMENonMultipart):
"""Class for generating audio/* MIME documents."""
def __init__(self, _audiodata, _subtype=None,
@@ -66,6 +66,6 @@ class MIMEAudio(MIMEBase.MIMEBase):
_subtype = _whatsnd(_audiodata)
if _subtype is None:
raise TypeError, 'Could not find audio MIME subtype'
- MIMEBase.MIMEBase.__init__(self, 'audio', _subtype, **_params)
+ MIMENonMultipart.__init__(self, 'audio', _subtype, **_params)
self.set_payload(_audiodata)
_encoder(self)
diff --git a/Lib/email/MIMEBase.py b/Lib/email/MIMEBase.py
index 28816e8..7485d85 100644
--- a/Lib/email/MIMEBase.py
+++ b/Lib/email/MIMEBase.py
@@ -4,7 +4,7 @@
"""Base class for MIME specializations.
"""
-import Message
+from email import Message
diff --git a/Lib/email/MIMEImage.py b/Lib/email/MIMEImage.py
index f0e7931a..29b0ea1 100644
--- a/Lib/email/MIMEImage.py
+++ b/Lib/email/MIMEImage.py
@@ -6,14 +6,13 @@
import imghdr
-# Intrapackage imports
-import MIMEBase
-import Errors
-import Encoders
+from email import Errors
+from email import Encoders
+from email.MIMENonMultipart import MIMENonMultipart
-class MIMEImage(MIMEBase.MIMEBase):
+class MIMEImage(MIMENonMultipart):
"""Class for generating image/* type MIME documents."""
def __init__(self, _imagedata, _subtype=None,
@@ -41,6 +40,6 @@ class MIMEImage(MIMEBase.MIMEBase):
_subtype = imghdr.what(None, _imagedata)
if _subtype is None:
raise TypeError, 'Could not guess image MIME subtype'
- MIMEBase.MIMEBase.__init__(self, 'image', _subtype, **_params)
+ MIMENonMultipart.__init__(self, 'image', _subtype, **_params)
self.set_payload(_imagedata)
_encoder(self)
diff --git a/Lib/email/MIMEMessage.py b/Lib/email/MIMEMessage.py
index 89da925..8fa86cb 100644
--- a/Lib/email/MIMEMessage.py
+++ b/Lib/email/MIMEMessage.py
@@ -4,12 +4,12 @@
"""Class representing message/* MIME documents.
"""
-import Message
-import MIMEBase
+from email import Message
+from email.MIMENonMultipart import MIMENonMultipart
-class MIMEMessage(MIMEBase.MIMEBase):
+class MIMEMessage(MIMENonMultipart):
"""Class representing message/* MIME documents."""
def __init__(self, _msg, _subtype='rfc822'):
@@ -22,7 +22,9 @@ class MIMEMessage(MIMEBase.MIMEBase):
default is "rfc822" (this is defined by the MIME standard, even though
the term "rfc822" is technically outdated by RFC 2822).
"""
- MIMEBase.MIMEBase.__init__(self, 'message', _subtype)
+ MIMENonMultipart.__init__(self, 'message', _subtype)
if not isinstance(_msg, Message.Message):
raise TypeError, 'Argument is not an instance of Message'
- self.set_payload(_msg)
+ # It's convenient to use this base class method. We need to do it
+ # this way or we'll get an exception
+ Message.Message.attach(self, _msg)
diff --git a/Lib/email/MIMEText.py b/Lib/email/MIMEText.py
index 8669d28..048f544 100644
--- a/Lib/email/MIMEText.py
+++ b/Lib/email/MIMEText.py
@@ -5,12 +5,12 @@
"""
import warnings
-import MIMEBase
-from Encoders import encode_7or8bit
+from email.MIMENonMultipart import MIMENonMultipart
+from email.Encoders import encode_7or8bit
-class MIMEText(MIMEBase.MIMEBase):
+class MIMEText(MIMENonMultipart):
"""Class for generating text/* type MIME documents."""
def __init__(self, _text, _subtype='plain', _charset='us-ascii',
@@ -33,8 +33,8 @@ class MIMEText(MIMEBase.MIMEBase):
override any header settings indicated by _charset. This is probably
not what you want.
"""
- MIMEBase.MIMEBase.__init__(self, 'text', _subtype,
- **{'charset': _charset})
+ MIMENonMultipart.__init__(self, 'text', _subtype,
+ **{'charset': _charset})
if _text and _text[-1] <> '\n':
_text += '\n'
self.set_payload(_text, _charset)