MCPcopy Create free account
hub / github.com/python/cpython / _handle_message_delivery_status

Method _handle_message_delivery_status

Lib/email/generator.py:338–357  ·  view source on GitHub ↗
(self, msg)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

_new_bufferMethod · 0.95
cloneMethod · 0.95
get_payloadMethod · 0.80
flattenMethod · 0.45
getvalueMethod · 0.45
splitMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected