From nobody Sat Apr 20 06:26:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547591497327881.5910731268265; Tue, 15 Jan 2019 14:31:37 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 14849792BA; Tue, 15 Jan 2019 22:31:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 03E3119748; Tue, 15 Jan 2019 22:31:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E8FD71C90; Tue, 15 Jan 2019 22:31:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0FMVYFW032233 for ; Tue, 15 Jan 2019 17:31:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3AF9418A77; Tue, 15 Jan 2019 22:31:34 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3842E5DEB4 for ; Tue, 15 Jan 2019 22:31:30 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 15 Jan 2019 23:31:29 +0100 Message-Id: <20190115223129.11798-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] views: include series tags in download link X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 15 Jan 2019 22:31:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Replies to the cover letter usually apply to all messages, so they should be included. This does mishandle things like For patches 1 and 2: Reviewed-by: Foo Bar but that is not really encouraged as it complicate things for both the submitter and other reviewers. Signed-off-by: Paolo Bonzini --- www/views.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/views.py b/www/views.py index e996170..c8570ca 100644 --- a/www/views.py +++ b/www/views.py @@ -278,14 +278,14 @@ def view_mbox(request, project, message_id): old_tags.add(line) =20 # If no --- line, tags go at the end as there's no better place - for tag in tags: + for tag in sorted(tags): if tag not in old_tags: yield tag if need_minusminusminus: yield line yield from lines =20 - def get_mbox_with_tags(m): + def get_mbox_with_tags(m, series_tags): mbox =3D m.get_mbox() msg =3D email.message_from_string(mbox) container =3D msg.get_payload(0) if msg.is_multipart() else msg @@ -299,7 +299,7 @@ def view_mbox(request, project, message_id): container.replace_header('Content-Transfer-Encoding', 'quoted-= printable') except KeyError: msg.add_header('Content-Transfer-Encoding', 'quoted-printable') - payload =3D '\n'.join(mbox_with_tags_iter(payload, m.tags)) + payload =3D '\n'.join(mbox_with_tags_iter(payload, set(m.tags).uni= on(series_tags))) payload =3D quopri.encodestring(payload.encode('utf-8')) container.set_payload(payload, charset=3D'utf-8') return msg.as_bytes(unixfrom=3DTrue) @@ -311,12 +311,14 @@ def view_mbox(request, project, message_id): if not s.is_complete: raise Http404("Series not complete") messages =3D s.get_patches() + series_tags =3D set(s.tags) else: messages =3D [s] + series_tags =3D set() =20 mbox_list =3D [] for message in messages: - mbox_list.append(get_mbox_with_tags(message)) + mbox_list.append(get_mbox_with_tags(message, series_tags)) mbox =3D b"\n".join(mbox_list) return HttpResponse(mbox, content_type=3D"text/plain") =20 --=20 2.20.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel