Handle message/news
This commit is contained in:
parent
d32c60a318
commit
df7fcb5777
11
mbox2web
11
mbox2web
|
@ -40,6 +40,7 @@ def render_message(msg):
|
|||
msgtmpl = jenv.get_template("message2.html")
|
||||
bodyhtml = render_body(msg)
|
||||
context = {
|
||||
"msg": msg,
|
||||
"message_id": msg["Message-Id"],
|
||||
"subject": msg["Subject"],
|
||||
"from": msg["From"],
|
||||
|
@ -243,6 +244,16 @@ def render_body(msg):
|
|||
elif content_type == "application/x-gzip":
|
||||
bodyhtml = save_part(msg)
|
||||
|
||||
elif content_type == "message/news":
|
||||
partshtml = []
|
||||
for part in msg.get_payload():
|
||||
partshtml.append(render_message(part))
|
||||
bodytmpl = jenv.get_template("body_message_news.html")
|
||||
context = {
|
||||
"msg": msg,
|
||||
"parts": partshtml,
|
||||
}
|
||||
bodyhtml = bodytmpl.render(context)
|
||||
else:
|
||||
raise RuntimeError("Content-type " + content_type + " not implemented yet")
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
</div>
|
||||
<div class="partinner">
|
||||
<table>
|
||||
<tr> <th>Newsgroups</th> <td>{{msg.newsgroups}} </td> </tr>
|
||||
<tr> <th>Message-Id </th> <td>{{message_id}} </td> </tr>
|
||||
<tr> <th>Subject </th> <td class="subject">{{subject}}</td> </tr>
|
||||
<tr> <th>From </th> <td>{{from}} </td> </tr>
|
||||
|
|
Loading…
Reference in New Issue