From nobody Thu Apr 25 21:21:50 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; dkim=fail; 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=1556795893; cv=none; d=zoho.com; s=zohoarc; b=kW8on7JKdOaZZDVjFP90woiwjluw2pN8Q0DjF7uBkFJKDSWA/Zc2UAZxwAgIHOV/2t5UjMmtIf7PG5MLEZp6R+jXB6/nZHJZcZJB7aPbvhU2o+i1vU3p64Tg9rMilAUBzcIVjrYEyoovhd8L5/dZWwFCNSz0WrG3++Ri0nfW3s8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556795893; 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=wkRu5VcOnYN3TXpCRIyeTQqxe2WqRZTzVhgdaXliMbs=; b=WNvaY58Uz/DvXbqwyC88JUhwxR5xwmJwT56ZQVEieLGEV88Cz7Ctf2t37uLFRYvuwXHavvK3r1+jAL3MbBnbMCTjReVtp9b6CHu/FJ2YAHtmUibi4lfWYJcFM+ZqS1bHsmUljR15QdK6LmKTM+0Cxol3XUeuSsjEXie3meeQg1Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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 1556795893291461.6894024133186; Thu, 2 May 2019 04:18:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03DE3C05FF7E; Thu, 2 May 2019 11:18:12 +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 E8C528ADAA; Thu, 2 May 2019 11:18:11 +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 DD14318089CA; Thu, 2 May 2019 11:18:11 +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 x42BIBkE008932 for ; Thu, 2 May 2019 07:18:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E147827A8; Thu, 2 May 2019 11:18:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68CDB7EFC4 for ; Thu, 2 May 2019 11:18:09 +0000 (UTC) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F0A2356F1 for ; Thu, 2 May 2019 11:18:08 +0000 (UTC) Received: by mail-ot1-f48.google.com with SMTP id s11so1711907otp.0 for ; Thu, 02 May 2019 04:18:08 -0700 (PDT) Received: from localhost.localdomain ([198.59.53.9]) by smtp.gmail.com with ESMTPSA id o1sm19095697otj.11.2019.05.02.04.18.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2019 04:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cTDaVUH5atKYH9f0YtS1I4Yib8Lp3R6m6zSaEhrwcg8=; b=d9sBBa95/zQ7rx5tGfr3NbX88cuslmf+0IpLO7TmCnsUeS/yUR2X9mL/KuLcRUGt0C 6/kGYBd9feMTU2K4h+cFSXFOjxH2xXIvC3xGyAm5+eCUK5L7WThiN5jVUhJ5bG0JPD6F vRWgjObmjuSsNIu2Vd7YOt8hRv5RzTN/OBhMkZtqrXChGa0f2QAxRIRZnw6gUVRPiiFJ BHrxTHORSPpKEqiUiR9fIdM4Lvcj1iUMBlzJAQoeDNZB3NcLEZ5Uh2Q88OUkpjL7Uq5J cKQYfVlI0HxBy3Dr3+uN34UU0RJbI7YrZiG/DT4wmpdHeMKHVxZffHsw7TU1w/H/QG6M FuXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cTDaVUH5atKYH9f0YtS1I4Yib8Lp3R6m6zSaEhrwcg8=; b=jyR9w582RrEDcHEGqGt4A2i/y6yuOZblcsC5mbp4KExfUG13vDwzxbgLmhHX5zSqRx rSbfLYQu5Uyfie2aiQCdW0tUgIz6aI3iIHtPvN7nmm6naJ71ftIsKUc/b+oMhRfDDtMJ D7k1xZi5prLz1S92BK52LiG/ec+uaetpJsxDl1aIw0Eoi5zGu8uaErvdXlTdiGBnJljx mDD13l0JJeqRZvHvExVHSJIDGx6zAk7PpTP10yplf2/4oD7IyezylSUPUYSzQzrY65hn wHP6/zldW0fJ8ihOjsA26FXK65GlwiUv6+EH9XgAAc/m6yDgzNLJTDVeSUBzUCFZKWdu hcaw== X-Gm-Message-State: APjAAAViRymZufmufQplzN9NeDH2G+CC76+2rWrcNAtrtbfGks3SCZTw O4xgHOXOXEgMgq4/oln3/fkcy35tgbA= X-Google-Smtp-Source: APXvYqwKSMPIeMZvtWOOJ2dXi1mgfAb6yyl2STl1K1kZD8IfKBvVmIsgJ9IHCklQM+YyrxIpIgxeuA== X-Received: by 2002:a05:6830:14c2:: with SMTP id t2mr2017372otq.64.1556795887601; Thu, 02 May 2019 04:18:07 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 2 May 2019 05:17:50 -0600 Message-Id: <20190502111804.15843-4-pbonzini@redhat.com> In-Reply-To: <20190502111804.15843-1-pbonzini@redhat.com> References: <20190502111804.15843-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 02 May 2019 11:18:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 02 May 2019 11:18:08 +0000 (UTC) for IP:'209.85.210.48' DOMAIN:'mail-ot1-f48.google.com' HELO:'mail-ot1-f48.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.126 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.210.48 mail-ot1-f48.google.com 209.85.210.48 mail-ot1-f48.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 03/17] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 02 May 2019 11:18:12 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Only return the two properties that patchew-cli actually needs, through a new hook. Do this before the configuration is moved out of the properties table, because these "properties" are actually configuration items. This will be cleaned up once patchew-cli switches to the REST API. Signed-off-by: Paolo Bonzini --- 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