MCPcopy Index your code
hub / github.com/python/cpython / attach

Method attach

Lib/email/message.py:233–247  ·  view source on GitHub ↗

Add the given payload to the current payload. The current payload will always be a list of objects after this method is called. If you want to set the payload to a scalar object, use set_payload() instead.

(self, payload)

Source from the content-addressed store, hash-verified

231 # Payload manipulation.
232 #
233 def attach(self, payload):
234 """Add the given payload to the current payload.
235
236 The current payload will always be a list of objects after this method
237 is called. If you want to set the payload to a scalar object, use
238 set_payload() instead.
239 """
240 if self._payload is None:
241 self._payload = [payload]
242 else:
243 try:
244 self._payload.append(payload)
245 except AttributeError:
246 raise TypeError("Attach is not valid on a message with a"
247 " non-multipart payload")
248
249 def get_payload(self, i=None, decode=False):
250 """Return a reference to the payload.

Callers 4

test_epilogueMethod · 0.95
test_no_nl_preambleMethod · 0.95
_new_messageMethod · 0.45
_add_multipartMethod · 0.45

Calls 1

appendMethod · 0.45

Tested by 2

test_epilogueMethod · 0.76
test_no_nl_preambleMethod · 0.76