--- message.py.orig 2009-04-06 06:29:17.000000000 -0400 +++ message.py 2009-04-06 06:33:31.000000000 -0400 @@ -159,7 +159,7 @@ else: self._payload.append(payload) - def get_payload(self, i=None, decode=False): + def get_payload(self, i=None, decode=False, silent=True): """Return a reference to the payload. The payload will either be a list object or a string. If you mutate @@ -196,7 +196,10 @@ return utils._bdecode(payload) except binascii.Error: # Incorrect padding - return payload + if silent: + return payload + else + raise elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'): sfp = StringIO() try: @@ -204,7 +207,10 @@ payload = sfp.getvalue() except uu.Error: # Some decoding problem - return payload + if silent: + return payload + else: + raise # Everything else, including encodings with 8bit or 7bit are returned # unchanged. return payload