[PATCH v2] Include all email headers in mboxes

vkabatov at redhat.com vkabatov at redhat.com
Fri Apr 6 01:51:58 AEST 2018


From: Veronika Kabatova <vkabatov at redhat.com>

Solves issue #165 (Exported mboxes should include In-Reply-To,
References, etc headers). Instead of including only a few chosen ones,
all received headers are added to mboxes.

Signed-off-by: Veronika Kabatova <vkabatov at redhat.com>
---
 patchwork/views/utils.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/patchwork/views/utils.py b/patchwork/views/utils.py
index 84682b8..f5ff43c 100644
--- a/patchwork/views/utils.py
+++ b/patchwork/views/utils.py
@@ -89,21 +89,17 @@ def _submission_to_mbox(submission):
     utc_timestamp = delta.seconds + delta.days * 24 * 3600
 
     mail = PatchMbox(body)
-    mail['Subject'] = submission.name
     mail['X-Patchwork-Submitter'] = email.utils.formataddr((
         str(Header(submission.submitter.name, mail.patch_charset)),
         submission.submitter.email))
     mail['X-Patchwork-Id'] = str(submission.id)
     if is_patch and submission.delegate:
         mail['X-Patchwork-Delegate'] = str(submission.delegate.email)
-    mail['Message-Id'] = submission.msgid
     mail.set_unixfrom('From patchwork ' + submission.date.ctime())
 
-    copied_headers = ['To', 'Cc', 'Date', 'From', 'List-Id']
     orig_headers = HeaderParser().parsestr(str(submission.headers))
-    for header in copied_headers:
-        if header in orig_headers:
-            mail[header] = orig_headers[header]
+    for key, val in orig_headers.items():
+        mail[key] = val
 
     if 'Date' not in mail:
         mail['Date'] = email.utils.formatdate(utc_timestamp)
-- 
2.13.6



More information about the Patchwork mailing list