blob: e1f51968b59eb1504416abb5f47f3bb32c296498 [file] [log] [blame]
Barry Warsaw40ef0062006-03-18 15:41:53 +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
Barry Warsaw40ef0062006-03-18 15:41:53 +00007__all__ = ['MIMENonMultipart']
8
9from email import errors
10from email.mime.base import MIMEBase
Barry Warsaw2f514a82002-06-01 05:59:12 +000011
12
13
Barry Warsaw40ef0062006-03-18 15:41:53 +000014class MIMENonMultipart(MIMEBase):
Georg Brandl52d0a1b2014-10-02 12:35:08 +020015 """Base class for MIME non-multipart type messages."""
Barry Warsaw2f514a82002-06-01 05:59:12 +000016
17 def attach(self, payload):
18 # The public API prohibits attaching multiple subparts to MIMEBase
19 # derived subtypes since none of them are, by definition, of content
20 # type multipart/*
Barry Warsaw40ef0062006-03-18 15:41:53 +000021 raise errors.MultipartConversionError(
Barry Warsaw2f514a82002-06-01 05:59:12 +000022 'Cannot attach additional subparts to non-multipart/*')