From nobody Fri Apr 26 05:15:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=patchew-devel-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1645538549; cv=none; d=zohomail.com; s=zohoarc; b=HSJlTq7iSRXMIFQKZ3s63SzZRru32xLeeygHrdo0W+NkJkHKGbsP/NKCRljGbjiGRaGcVRHu6IcAH6b19OLx7pTR+lQ6iloRnxBYH6xq0UmP54+pM0+FJGva5QrYSKPX5DkAprtJExk2wILl9V93RuuH9Ln5HAWHGKg0Swfl8+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645538549; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=elHvya60I5yzSFKXMGjJfrEigC2wPF8uvarp7pGu744=; b=aXyijJjuFiEKR2rv4GHwMiJBFeneRlyop76T3mRQDmHTwTau25dqgC8T5glmwckk/EJp3rST61R8B01YExwaZSnd3vOmVygzoZY1Osg77ie9ioWlGo5FGGgQuhNOBIQ6y7uPspt1BUfLIdxQRZLzzIHDW2MioYXKeKZITBM5jSg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1645538549345748.2880364758172; Tue, 22 Feb 2022 06:02:29 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-450-taMezoXwPn-LVDBae8isYQ-1; Tue, 22 Feb 2022 09:02:24 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CADDC6C500; Tue, 22 Feb 2022 14:02:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2E39832BD; Tue, 22 Feb 2022 14:02:23 +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 BA0C21809C98; Tue, 22 Feb 2022 14:02:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21ME2MrP000728 for ; Tue, 22 Feb 2022 09:02:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id B77AF832B4; Tue, 22 Feb 2022 14:02:22 +0000 (UTC) Received: from avogadro.lan (unknown [10.39.195.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2AA767C3FD for ; Tue, 22 Feb 2022 14:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645538548; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=elHvya60I5yzSFKXMGjJfrEigC2wPF8uvarp7pGu744=; b=dMGD3dk+Xt5tsHawqOTXDAAub3RQkaDYIObJKEXUrY/+4xNaCbmd2s+MCx3k3kIBxowcQD ESe0iBvTOkONLF/lFflduWHW8a+Ay1Eae6VjWNJhGVKS6tDwWmivPZkny0fxSQiMNVD7A5 Zf6xO5YF1LOtDr2poQEuoCebzksJPMM= X-MC-Unique: taMezoXwPn-LVDBae8isYQ-1 From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 22 Feb 2022 15:01:41 +0100 Message-Id: <20220222140141.190989-4-pbonzini@redhat.com> In-Reply-To: <20220222140141.190989-1-pbonzini@redhat.com> References: <20220222140141.190989-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 3/3] maintainer: allow downloading queue mbox 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: , Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=patchew-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1645538551520100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- api/models.py | 7 +++++-- mods/maintainer.py | 24 ++++++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/api/models.py b/api/models.py index 18392b1..2c503ed 100644 --- a/api/models.py +++ b/api/models.py @@ -688,7 +688,7 @@ class Message(models.Model): container.set_payload(payload, charset=3D"utf-8") return msg.as_bytes(unixfrom=3DTrue) =20 - def get_mbox_with_tags(self): + def get_mboxes_with_tags(self): if not self.is_patch: if not self.is_complete: return None @@ -701,7 +701,10 @@ class Message(models.Model): mbox_list =3D [] for message in messages: mbox_list.append(message._get_mbox_with_tags(series_tags)) - return b"\n".join(mbox_list) + return mbox_list + + def get_mbox_with_tags(self): + return b"\n".join(self.get_mboxes_with_tags()) =20 def get_num(self): assert self.is_patch or self.is_series_head diff --git a/mods/maintainer.py b/mods/maintainer.py index d650ec4..4d4d7e9 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -11,7 +11,7 @@ import re from django.conf.urls import url from django.core.exceptions import PermissionDenied -from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequ= est +from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpR= esponseBadRequest from django.urls import reverse from mod import PatchewModule from api.models import Message, QueuedSeries, Project, WatchedQuery @@ -165,7 +165,7 @@ class MaintainerModule(PatchewModule): self._drop_from_queue(request.user, m, queue) return HttpResponseRedirect(request.META.get("HTTP_REFERER")) =20 - def www_view_queue(self, request, project, name): + def query_queue(self, request, project, name): if not request.user.is_authenticated: raise PermissionDenied() =20 @@ -175,12 +175,27 @@ class MaintainerModule(PatchewModule): po =3D Project.objects.filter(name=3Dproject).first() if not po: raise Http404("Project not found") + return Message.objects.series_heads(po.id).filter(queuedseries=3Dq) =20 + def www_download_queue_mbox(self, request, project, name): + query =3D self.query_queue(request, project, name).filter(is_compl= ete=3DTrue) + mbox_list =3D [] + for s in query: + mbox_list.extend(s.get_mboxes_with_tags()) + mbox =3D b"\n".join(mbox_list) + return HttpResponse(mbox, content_type=3D"text/plain") + + def www_view_queue(self, request, project, name): + query =3D self.query_queue(request, project, name) search =3D 'project:' + project + ' queue:' + name - query =3D Message.objects.series_heads(po.id).filter(queuedseries= =3Dq) return render_series_list_page(request, query, search=3Dsearch, project=3Dproject, - title=3D'"' + name + '" queue') + title=3D'"' + name + '" queue', + link_icon=3D'fa fa-download', + link_text=3D'Download mbox', + link_url=3Dreverse("maintainer_queu= e_mbox", + kwargs=3D{"project= ": project, + "name": na= me})) =20 def www_view_my_queues(self, request, project=3DNone): if not request.user.is_authenticated: @@ -274,6 +289,7 @@ class MaintainerModule(PatchewModule): ) ) urlpatterns.append(url(r"^my-queues/(?P[^/]*)/(?P[^= /]*)/$", self.www_view_queue, name=3D"maintainer_queue")) + urlpatterns.append(url(r"^my-queues/(?P[^/]*)/(?P[^= /]*)/mbox$", self.www_download_queue_mbox, name=3D"maintainer_queue_mbox")) urlpatterns.append(url(r"^my-queues/(?P[^/]*)/$", self.ww= w_view_my_queues)) urlpatterns.append(url(r"^my-queues/$", self.www_view_my_queues)) urlpatterns.append(url(r"^watch-query/$", self.www_view_watch_quer= y)) --=20 2.34.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel