(self, msg)
| 357 | self._fp.write(self._encoded_NL.join(blocks)) |
| 358 | |
| 359 | def _handle_message(self, msg): |
| 360 | s = self._new_buffer() |
| 361 | g = self.clone(s) |
| 362 | # The payload of a message/rfc822 part should be a multipart sequence |
| 363 | # of length 1. The zeroth element of the list should be the Message |
| 364 | # object for the subpart. Extract that object, stringify it, and |
| 365 | # write it out. |
| 366 | # Except, it turns out, when it's a string instead, which happens when |
| 367 | # and only when HeaderParser is used on a message of mime type |
| 368 | # message/rfc822. Such messages are generated by, for example, |
| 369 | # Groupwise when forwarding unadorned messages. (Issue 7970.) So |
| 370 | # in that case we just emit the string body. |
| 371 | payload = msg._payload |
| 372 | if isinstance(payload, list): |
| 373 | g.flatten(msg.get_payload(0), unixfrom=False, linesep=self._NL) |
| 374 | payload = s.getvalue() |
| 375 | else: |
| 376 | payload = self._encode(payload) |
| 377 | self._fp.write(payload) |
| 378 | |
| 379 | # This used to be a module level function; we use a classmethod for this |
| 380 | # and _compile_re so we can continue to provide the module level function |
nothing calls this directly
no test coverage detected