PyXR

c:\python24\lib \ email \ MIMEMessage.py



0001 # Copyright (C) 2001-2004 Python Software Foundation
0002 # Author: Barry Warsaw
0003 # Contact: email-sig@python.org
0004 
0005 """Class representing message/* MIME documents."""
0006 
0007 from email import Message
0008 from email.MIMENonMultipart import MIMENonMultipart
0009 
0010 
0011 
0012 class MIMEMessage(MIMENonMultipart):
0013     """Class representing message/* MIME documents."""
0014 
0015     def __init__(self, _msg, _subtype='rfc822'):
0016         """Create a message/* type MIME document.
0017 
0018         _msg is a message object and must be an instance of Message, or a
0019         derived class of Message, otherwise a TypeError is raised.
0020 
0021         Optional _subtype defines the subtype of the contained message.  The
0022         default is "rfc822" (this is defined by the MIME standard, even though
0023         the term "rfc822" is technically outdated by RFC 2822).
0024         """
0025         MIMENonMultipart.__init__(self, 'message', _subtype)
0026         if not isinstance(_msg, Message.Message):
0027             raise TypeError('Argument is not an instance of Message')
0028         # It's convenient to use this base class method.  We need to do it
0029         # this way or we'll get an exception
0030         Message.Message.attach(self, _msg)
0031         # And be sure our default type is set correctly
0032         self.set_default_type('message/rfc822')
0033 

Generated by PyXR 0.9.4
SourceForge.net Logo