2006-04-21 07:40:58 -03:00
|
|
|
|
# Copyright (C) 2001-2006 Python Software Foundation
|
2004-10-03 00:16:19 -03:00
|
|
|
|
# Author: Barry Warsaw
|
|
|
|
|
# Contact: email-sig@python.org
|
2001-09-23 00:17:28 -03:00
|
|
|
|
|
2004-10-03 00:16:19 -03:00
|
|
|
|
"""Base class for MIME specializations."""
|
2001-09-23 00:17:28 -03:00
|
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
|
__all__ = ['MIMEBase']
|
|
|
|
|
|
|
|
|
|
from email import message
|
2001-09-23 00:17:28 -03:00
|
|
|
|
|
|
|
|
|
|
2001-10-04 14:05:11 -03:00
|
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
|
class MIMEBase(message.Message):
|
2001-09-23 00:17:28 -03:00
|
|
|
|
"""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.
|
|
|
|
|
"""
|
2006-04-21 07:40:58 -03:00
|
|
|
|
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'
|