blob: dd280b51d03e1d0c755dc612f6973ec15725d29b [file] [log] [blame]
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00001# Copyright (C) 2002-2006 Python Software Foundation
Barry Warsawbb113862004-10-03 03:16:19 +00002# Author: Barry Warsaw
3# Contact: email-sig@python.org
Barry Warsaw2f514a82002-06-01 05:59:12 +00004
Barry Warsawbb113862004-10-03 03:16:19 +00005"""Base class for MIME type messages that are not multipart."""
Barry Warsaw2f514a82002-06-01 05:59:12 +00006
Thomas Wouters49fd7fa2006-04-21 10:40:58 +00007__all__ = ['MIMENonMultipart']
8
9from email import errors
10from email.mime.base import MIMEBase
Barry Warsaw2f514a82002-06-01 05:59:12 +000011
12
13
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000014class MIMENonMultipart(MIMEBase):
Barry Warsaw2f514a82002-06-01 05:59:12 +000015 """Base class for MIME multipart/* type messages."""
16
Barry Warsaw5f253272002-09-28 20:25:15 +000017 __pychecker__ = 'unusednames=payload'
18
Barry Warsaw2f514a82002-06-01 05:59:12 +000019 def attach(self, payload):
20 # The public API prohibits attaching multiple subparts to MIMEBase
21 # derived subtypes since none of them are, by definition, of content
22 # type multipart/*
Thomas Wouters49fd7fa2006-04-21 10:40:58 +000023 raise errors.MultipartConversionError(
Barry Warsaw2f514a82002-06-01 05:59:12 +000024 'Cannot attach additional subparts to non-multipart/*')
Barry Warsaw5f253272002-09-28 20:25:15 +000025
26 del __pychecker__