diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-03-06 11:44:17 -0500 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-03-06 11:44:17 -0500 |
commit | 5dda12491e3e2233b63737a1c5f6066f54f6deb5 (patch) | |
tree | adb09127fa2582cf98e47f3e643b7ba7f8a36001 /Lib/email/message.py | |
parent | 733e50ad9ee2885323c39080b42716fa5d1fd8c1 (diff) | |
download | cpython-git-5dda12491e3e2233b63737a1c5f6066f54f6deb5.tar.gz |
#11558: Better message if attach called on non-multipart.
Original patch by Varun Sharma.
Diffstat (limited to 'Lib/email/message.py')
-rw-r--r-- | Lib/email/message.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py index 88b5fa3552..b4bc8cbc9e 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -203,7 +203,11 @@ class Message: if self._payload is None: self._payload = [payload] else: - self._payload.append(payload) + try: + self._payload.append(payload) + except AttributeError: + raise TypeError("Attach is not valid on a message with a" + " non-multipart payload") def get_payload(self, i=None, decode=False): """Return a reference to the payload. |