nonmultipart.py 689 B

123456789101112131415161718192021
  1. # Copyright (C) 2002-2006 Python Software Foundation
  2. # Author: Barry Warsaw
  3. # Contact: email-sig@python.org
  4. """Base class for MIME type messages that are not multipart."""
  5. __all__ = ['MIMENonMultipart']
  6. from email import errors
  7. from email.mime.base import MIMEBase
  8. class MIMENonMultipart(MIMEBase):
  9. """Base class for MIME non-multipart type messages."""
  10. def attach(self, payload):
  11. # The public API prohibits attaching multiple subparts to MIMEBase
  12. # derived subtypes since none of them are, by definition, of content
  13. # type multipart/*
  14. raise errors.MultipartConversionError(
  15. 'Cannot attach additional subparts to non-multipart/*')