Control: tags -1 patch

attaching a trivial patch to make the system show the MIME part


(bad indentation here, the attachment is correct)

diff --git a/backend/email.py b/backend/email.py
index c127a25..c688602 100644
--- a/backend/email.py
+++ b/backend/email.py
@@ -101,6 +101,9 @@ def send_nonce(template_name, person, nonce=None, 
encrypted_nonce=None):
def get_mbox_as_dicts(filename):
try:  ## we are reading, have not to flush with close
for message in mailbox.mbox(filename, create=False):
-            yield dict(Body=message.get_payload(), **dict(message))
+            if(message.is_multipart()):
+                yield dict(Body=message.get_payload(0), **dict(message))
+            else:
+                yield dict(Body=message.get_payload(), **dict(message))
except mailbox.NoSuchMailboxError:
return
From a76fe8a3bdfed24669c65710199915ff71b50f8c Mon Sep 17 00:00:00 2001
From: Gianfranco Costamagna <[email protected]>
Date: Fri, 12 Jun 2015 18:56:01 +0200
Subject: [PATCH] Try to print MIME messages in display-mail-archive (Closes:
 #787155). This is far from ideal, the message should be parsed, but it is at
 least showing something

---
 backend/email.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/backend/email.py b/backend/email.py
index c127a25..c688602 100644
--- a/backend/email.py
+++ b/backend/email.py
@@ -101,6 +101,9 @@ def send_nonce(template_name, person, nonce=None, encrypted_nonce=None):
 def get_mbox_as_dicts(filename):
     try:  ## we are reading, have not to flush with close
         for message in mailbox.mbox(filename, create=False):
-            yield dict(Body=message.get_payload(), **dict(message))
+            if(message.is_multipart()):
+                yield dict(Body=message.get_payload(0), **dict(message))
+            else:
+                yield dict(Body=message.get_payload(), **dict(message))
     except mailbox.NoSuchMailboxError:
         return
-- 
2.1.4

Reply via email to