New submission from Bob Glickstein <bob.glickst...@gmail.com>: Passing both a value for i and decode=True to email.message.Message.get_payload(), when self is a multipart, returns None when it should return a string. The reason is that an is_multipart() test is done on self when it should instead be done on the selected payload part. Here's a patch that fixes this:
--- /usr/lib64/python2.7/email/message.py 2011-10-26 18:40:36.000000000 -0700 +++ /home/bobg/tmp/message.py 2012-05-07 06:34:28.579401481 -0700 @@ -192,9 +192,9 @@ else: payload = self._payload[i] if decode: - if self.is_multipart(): + if payload.is_multipart(): return None - cte = self.get('content-transfer-encoding', '').lower() + cte = payload.get('content-transfer-encoding', '').lower() if cte == 'quoted-printable': return utils._qdecode(payload) elif cte == 'base64': ---------- components: Library (Lib) messages: 160144 nosy: Bob.Glickstein priority: normal severity: normal status: open title: get_payload(n, True) returns None type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14740> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com