| 1 | # Copyright (C) 2001-2004 Python Software Foundation |
| 2 | # Author: Barry Warsaw |
| 3 | # Contact: email-sig@python.org |
| 4 | |
| 5 | """Base class for MIME specializations.""" |
| 6 | |
| 7 | from email import Message |
| 8 | |
| 9 | |
| 10 | \f |
| 11 | class MIMEBase(Message.Message): |
| 12 | """Base class for MIME specializations.""" |
| 13 | |
| 14 | def __init__(self, _maintype, _subtype, **_params): |
| 15 | """This constructor adds a Content-Type: and a MIME-Version: header. |
| 16 | |
| 17 | The Content-Type: header is taken from the _maintype and _subtype |
| 18 | arguments. Additional parameters for this header are taken from the |
| 19 | keyword arguments. |
| 20 | """ |
| 21 | Message.Message.__init__(self) |
| 22 | ctype = '%s/%s' % (_maintype, _subtype) |
| 23 | self.add_header('Content-Type', ctype, **_params) |
| 24 | self['MIME-Version'] = '1.0' |