Pass extra parameter to children of multipart/alternative

A structure like this is quite common:

  ─><no description>                    [multipa/related, 7bit, 12K]
   ├─><no description>              [multipa/alternativ, 7bit, 9.0K]
   │ ├─><no description>      [text/plain, quoted, iso-8859-1, 3.7K]
   │ └─><no description>       [text/html, quoted, iso-8859-1, 4.9K]
   └─>2b0063.jpg                          [image/jpeg, base64, 3.3K]

Here the main content of multipart/related isn't the html part, but a
multipart/alternative containing the html part and a text part. The html
part still needs access to the onther content of the multipart/related
part, so we need to pass this through.
This commit is contained in:
Peter J. Holzer 2019-05-12 21:37:26 +02:00
parent a44ff7ee4b
commit c84c517f62
1 changed files with 1 additions and 1 deletions

View File

@ -254,7 +254,7 @@ def render_body(msg, extra=None):
partstypes = [] partstypes = []
for part in msg.get_payload(): for part in msg.get_payload():
partstypes.append(part.get_content_type()) partstypes.append(part.get_content_type())
partshtml.append(render_body(part)) partshtml.append(render_body(part, extra))
bodytmpl = jenv.get_template("body_multipart_alternative.html") bodytmpl = jenv.get_template("body_multipart_alternative.html")
context = { context = {
"types": partstypes, "types": partstypes,