This commit was manufactured by cvs2svn to create tag 'r23b1-mac'.
[python/dscho.git] / Lib / email / MIMEMultipart.py
blob16add2f8ca9f3aeff58006f3a460940f719a53e7
1 # Copyright (C) 2002 Python Software Foundation
2 # Author: barry@zope.com (Barry Warsaw)
4 """Base class for MIME multipart/* type messages.
5 """
7 from email import MIMEBase
11 class MIMEMultipart(MIMEBase.MIMEBase):
12 """Base class for MIME multipart/* type messages."""
14 def __init__(self, _subtype='mixed', boundary=None, *_subparts, **_params):
15 """Creates a multipart/* type message.
17 By default, creates a multipart/mixed message, with proper
18 Content-Type and MIME-Version headers.
20 _subtype is the subtype of the multipart content type, defaulting to
21 `mixed'.
23 boundary is the multipart boundary string. By default it is
24 calculated as needed.
26 _subparts is a sequence of initial subparts for the payload. It
27 must be possible to convert this sequence to a list. You can always
28 attach new subparts to the message by using the attach() method.
30 Additional parameters for the Content-Type header are taken from the
31 keyword arguments (or passed into the _params argument).
32 """
33 MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **_params)
34 if _subparts:
35 self.attach(*list(_subparts))
36 if boundary:
37 self.set_boundary(boundary)