/Lib/email/mime/base.py

http://unladen-swallow.googlecode.com/ · Python · 26 lines · 9 code · 6 blank · 11 comment · 0 complexity · 9768392a63381de6d9b5034b737974f9 MD5 · raw file

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