PYTHON   21

nonmultipart.py

Guest on 3rd June 2021 05:49:53 AM

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

Raw Paste


Login or Register to edit or fork this paste. It's free.