Barry Warsaw | 409a4c0 | 2002-04-10 21:01:31 +0000 | [diff] [blame] | 1 | # Copyright (C) 2001,2002 Python Software Foundation |
Barry Warsaw | ba92580 | 2001-09-23 03:17:28 +0000 | [diff] [blame] | 2 | # Author: barry@zope.com (Barry Warsaw) |
| 3 | |
| 4 | """Base class for MIME specializations. |
| 5 | """ |
| 6 | |
| 7 | import Message |
| 8 | |
| 9 | |
Barry Warsaw | e968ead | 2001-10-04 17:05:11 +0000 | [diff] [blame] | 10 | |
Barry Warsaw | ba92580 | 2001-09-23 03:17:28 +0000 | [diff] [blame] | 11 | class MIMEBase(Message.Message): |
| 12 | """Base class for MIME specializations.""" |
| 13 | |
Barry Warsaw | 76fac8e | 2001-09-26 05:36:36 +0000 | [diff] [blame] | 14 | def __init__(self, _maintype, _subtype, **_params): |
Barry Warsaw | ba92580 | 2001-09-23 03:17:28 +0000 | [diff] [blame] | 15 | """This constructor adds a Content-Type: and a MIME-Version: header. |
| 16 | |
Barry Warsaw | 76fac8e | 2001-09-26 05:36:36 +0000 | [diff] [blame] | 17 | The Content-Type: header is taken from the _maintype and _subtype |
Barry Warsaw | ba92580 | 2001-09-23 03:17:28 +0000 | [diff] [blame] | 18 | arguments. Additional parameters for this header are taken from the |
| 19 | keyword arguments. |
| 20 | """ |
| 21 | Message.Message.__init__(self) |
Barry Warsaw | 76fac8e | 2001-09-26 05:36:36 +0000 | [diff] [blame] | 22 | ctype = '%s/%s' % (_maintype, _subtype) |
Barry Warsaw | ba92580 | 2001-09-23 03:17:28 +0000 | [diff] [blame] | 23 | self.add_header('Content-Type', ctype, **_params) |
| 24 | self['MIME-Version'] = '1.0' |