From nobody Tue May 13 19:44:59 2025 Delivered-To: importer2@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 ARC-Seal: i=1; a=rsa-sha256; t=1555604515; cv=none; d=zoho.com; s=zohoarc; b=nE/+WBAakpEMP1Cbl9W4IhrZAobI7dbQg1ZsdpWD4myns0J0y3jwyB5VxE6CmMesc4ot4mZzgitUw6QMoe5NDsXAZdNs1IF0H/AfYewC0s5zziHnkZ2/r8ES7tdwsYkUyWcCDYRPpjpRnF4jO1o012PefL9rrnsBcPlQVJg/3mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555604515; 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:ARC-Authentication-Results; bh=ZmMg0rxdeM4ke0tyP9oEyMSeEQMSOmML1Qqit70siBk=; b=N9av8Uv8Edy7FQoKHZ9OToxHzTCgsO006kFBKNV5yC3zK0L/hdx1hZ65FJDbfpfU8x5zbRGlIsjXExZoFD5v7vE1T5DoXgzy75a2LsgB7W9dkERB3sLitm6qytmnHQB3hO+sEoD+d0cFSewYGmeWWj7GDpM6FTe6gkwTPiUb0+E= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555604515825481.9875044095205; Thu, 18 Apr 2019 09:21:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1E7830B4A68; Thu, 18 Apr 2019 16:21:54 +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 943CE600C1; Thu, 18 Apr 2019 16:21:54 +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 8AD884EA71; Thu, 18 Apr 2019 16:21:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3IGLrdT009166 for ; Thu, 18 Apr 2019 12:21:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id CEAC760BFC; Thu, 18 Apr 2019 16:21:53 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35D9F60BE5 for ; Thu, 18 Apr 2019 16:21:52 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 18 Apr 2019 18:21:39 +0200 Message-Id: <20190418162146.5695-4-pbonzini@redhat.com> In-Reply-To: <20190418162146.5695-1-pbonzini@redhat.com> References: <20190418162146.5695-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 03/10] api: do not blindly return all properties from get-projects 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.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 18 Apr 2019 16:21:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Only return the two properties that patchew-cli actually needs, through a new hook. --- api/views.py | 6 +++++- mods/git.py | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/api/views.py b/api/views.py index 4ac5636..887f9ed 100644 --- a/api/views.py +++ b/api/views.py @@ -18,6 +18,7 @@ import json from .search import SearchEngine from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator +from mod import dispatch_module_hook =20 =20 class APIView(View): @@ -83,8 +84,11 @@ def prepare_project(p): "url": p.url, "git": p.git, "description": p.description, - "properties": p.get_properties(), + "properties": {}, } + dispatch_module_hook("get_projects_prepare_hook", project=3Dp, + response=3Dret['properties']) + return ret =20 =20 diff --git a/mods/git.py b/mods/git.py index d0b1f87..89e711d 100644 --- a/mods/git.py +++ b/mods/git.py @@ -128,6 +128,10 @@ class GitModule(PatchewModule): def rest_series_fields_hook(self, request, fields, detailed): fields['based_on'] =3D PluginMethodField(obj=3Dself, required=3DFa= lse) =20 + def get_projects_prepare_hook(self, project, response): + response["git.head"] =3D project.get_property("git.head") + response["git.push_to"] =3D project.get_property("git.push_to") + def prepare_message_hook(self, request, message, detailed): if not message.is_series_head: return --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel