diff mbox series

[v2] Include all email headers in mboxes

Message ID 20180405155158.6510-1-vkabatov@redhat.com
State Accepted
Headers show
Series [v2] Include all email headers in mboxes | expand

Commit Message

Veronika Kabatova April 5, 2018, 3:51 p.m. UTC
From: Veronika Kabatova <vkabatov@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@redhat.com>
---
 patchwork/views/utils.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Stephen Finucane April 7, 2018, 4:14 p.m. UTC | #1
On Thu, 2018-04-05 at 17:51 +0200, vkabatov@redhat.com wrote:
> From: Veronika Kabatova <vkabatov@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@redhat.com>

Yup, looks good to me. Applied.

Reviewed-by: Stephen Finucane <stephen@that.guru>

Stephen
diff mbox series

Patch

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)