2001-09-23 03:17:28 +00:00
|
|
|
|
# Copyright (C) 2001 Python Software Foundation
|
|
|
|
|
# Author: barry@zope.com (Barry Warsaw)
|
|
|
|
|
|
|
|
|
|
"""Base class for MIME specializations.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import Message
|
|
|
|
|
|
|
|
|
|
|
2001-10-04 17:05:11 +00:00
|
|
|
|
|
2001-09-23 03:17:28 +00:00
|
|
|
|
class MIMEBase(Message.Message):
|
|
|
|
|
"""Base class for MIME specializations."""
|
|
|
|
|
|
2001-09-26 05:36:36 +00:00
|
|
|
|
def __init__(self, _maintype, _subtype, **_params):
|
2001-09-23 03:17:28 +00:00
|
|
|
|
"""This constructor adds a Content-Type: and a MIME-Version: header.
|
|
|
|
|
|
2001-09-26 05:36:36 +00:00
|
|
|
|
The Content-Type: header is taken from the _maintype and _subtype
|
2001-09-23 03:17:28 +00:00
|
|
|
|
arguments. Additional parameters for this header are taken from the
|
|
|
|
|
keyword arguments.
|
|
|
|
|
"""
|
|
|
|
|
Message.Message.__init__(self)
|
2001-09-26 05:36:36 +00:00
|
|
|
|
ctype = '%s/%s' % (_maintype, _subtype)
|
2001-09-23 03:17:28 +00:00
|
|
|
|
self.add_header('Content-Type', ctype, **_params)
|
|
|
|
|
self['MIME-Version'] = '1.0'
|