Return the number of attachments to this MIMEMultipart by looking at its 'Number-Attachments' header.
(self, outer_msg, new_count=None)
| 324 | self._attach_part(append_msg, msg) |
| 325 | |
| 326 | def _multi_part_count(self, outer_msg, new_count=None): |
| 327 | """ |
| 328 | Return the number of attachments to this MIMEMultipart by looking |
| 329 | at its 'Number-Attachments' header. |
| 330 | """ |
| 331 | if ATTACHMENT_FIELD not in outer_msg: |
| 332 | outer_msg[ATTACHMENT_FIELD] = "0" |
| 333 | |
| 334 | if new_count is not None: |
| 335 | _replace_header(outer_msg, ATTACHMENT_FIELD, str(new_count)) |
| 336 | |
| 337 | fetched_count = 0 |
| 338 | try: |
| 339 | fetched_count = int(outer_msg.get(ATTACHMENT_FIELD)) |
| 340 | except (ValueError, TypeError): |
| 341 | _replace_header(outer_msg, ATTACHMENT_FIELD, str(fetched_count)) |
| 342 | return fetched_count |
| 343 | |
| 344 | def _attach_part(self, outer_msg, part): |
| 345 | """ |
no test coverage detected