/Lib/email/mime/nonmultipart.py

http://unladen-swallow.googlecode.com/ · Python · 26 lines · 10 code · 8 blank · 8 comment · 0 complexity · e36938db1c6f73d86069db8f911bd7e1 MD5 · raw file

  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 multipart/* type messages."""
  10. __pychecker__ = 'unusednames=payload'
  11. def attach(self, payload):
  12. # The public API prohibits attaching multiple subparts to MIMEBase
  13. # derived subtypes since none of them are, by definition, of content
  14. # type multipart/*
  15. raise errors.MultipartConversionError(
  16. 'Cannot attach additional subparts to non-multipart/*')
  17. del __pychecker__