From patchwork Thu Apr 5 15:51:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Veronika Kabatova X-Patchwork-Id: 895443 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40H6ms37Cxz9ry1 for ; Fri, 6 Apr 2018 01:53:17 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40H6ms1gsVzF1qT for ; Fri, 6 Apr 2018 01:53:17 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=vkabatov@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40H6ln2D7mzF1vP for ; Fri, 6 Apr 2018 01:52:20 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E40C74005F9A for ; Thu, 5 Apr 2018 15:52:16 +0000 (UTC) Received: from vkabatova.usersys.redhat.com (unknown [10.43.17.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3FEC10B00B6; Thu, 5 Apr 2018 15:52:16 +0000 (UTC) From: vkabatov@redhat.com To: patchwork@lists.ozlabs.org Subject: [PATCH v2] Include all email headers in mboxes Date: Thu, 5 Apr 2018 17:51:58 +0200 Message-Id: <20180405155158.6510-1-vkabatov@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 05 Apr 2018 15:52:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 05 Apr 2018 15:52:16 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkabatov@redhat.com' RCPT:'' X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Veronika Kabatova 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 Reviewed-by: Stephen Finucane --- 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)