blob: fc4b2c6bdc9a507c7b8e630a5b9b91301881e1bb [file] [log] [blame]
Barry Warsaw3dd978d2001-09-26 05:34:30 +00001# Copyright (C) 2001 Python Software Foundation
2# Author: barry@zope.com (Barry Warsaw)
3
4"""Class representing message/* MIME documents.
5"""
6
7import Message
8import MIMEBase
9
10
Barry Warsawe968ead2001-10-04 17:05:11 +000011
Barry Warsaw3dd978d2001-09-26 05:34:30 +000012class MIMEMessage(MIMEBase.MIMEBase):
13 """Class representing message/* MIME documents."""
14
15 def __init__(self, _msg, _subtype='rfc822'):
16 """Create a message/* type MIME document.
17
18 _msg is a message object and must be an instance of Message, or a
19 derived class of Message, otherwise a TypeError is raised.
20
21 Optional _subtype defines the subtype of the contained message. The
22 default is "rfc822" (this is defined by the MIME standard, even though
23 the term "rfc822" is technically outdated by RFC 2822).
24 """
25 MIMEBase.MIMEBase.__init__(self, 'message', _subtype)
26 if not isinstance(_msg, Message.Message):
27 raise TypeError, 'Argument is not an instance of Message'
28 self.set_payload(_msg)