Barry Warsaw | bb11386 | 2004-10-03 03:16:19 +0000 | [diff] [blame] | 1 | # Copyright (C) 2002-2004 Python Software Foundation |
| 2 | # Author: Barry Warsaw |
| 3 | # Contact: email-sig@python.org |
Barry Warsaw | 2f514a8 | 2002-06-01 05:59:12 +0000 | [diff] [blame] | 4 | |
Barry Warsaw | bb11386 | 2004-10-03 03:16:19 +0000 | [diff] [blame] | 5 | """Base class for MIME type messages that are not multipart.""" |
Barry Warsaw | 2f514a8 | 2002-06-01 05:59:12 +0000 | [diff] [blame] | 6 | |
| 7 | from email import Errors |
| 8 | from email import MIMEBase |
| 9 | |
| 10 | |
| 11 | |
| 12 | class MIMENonMultipart(MIMEBase.MIMEBase): |
| 13 | """Base class for MIME multipart/* type messages.""" |
| 14 | |
Barry Warsaw | 5f25327 | 2002-09-28 20:25:15 +0000 | [diff] [blame] | 15 | __pychecker__ = 'unusednames=payload' |
| 16 | |
Barry Warsaw | 2f514a8 | 2002-06-01 05:59:12 +0000 | [diff] [blame] | 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/* |
| 21 | raise Errors.MultipartConversionError( |
| 22 | 'Cannot attach additional subparts to non-multipart/*') |
Barry Warsaw | 5f25327 | 2002-09-28 20:25:15 +0000 | [diff] [blame] | 23 | |
| 24 | del __pychecker__ |