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