(self, msg)
| 335 | self.policy = p |
| 336 | |
| 337 | def _handle_message_delivery_status(self, msg): |
| 338 | # We can't just write the headers directly to self's file object |
| 339 | # because this will leave an extra newline between the last header |
| 340 | # block and the boundary. Sigh. |
| 341 | blocks = [] |
| 342 | for part in msg.get_payload(): |
| 343 | s = self._new_buffer() |
| 344 | g = self.clone(s) |
| 345 | g.flatten(part, unixfrom=False, linesep=self._NL) |
| 346 | text = s.getvalue() |
| 347 | lines = text.split(self._encoded_NL) |
| 348 | # Strip off the unnecessary trailing empty line |
| 349 | if lines and lines[-1] == self._encoded_EMPTY: |
| 350 | blocks.append(self._encoded_NL.join(lines[:-1])) |
| 351 | else: |
| 352 | blocks.append(text) |
| 353 | # Now join all the blocks with an empty line. This has the lovely |
| 354 | # effect of separating each block with an empty line, but not adding |
| 355 | # an extra one after the last one. |
| 356 | self._fp.write(self._encoded_NL.join(blocks)) |
| 357 | |
| 358 | def _handle_message(self, msg): |
| 359 | s = self._new_buffer() |
nothing calls this directly
no test coverage detected