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)
| 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. |