From nobody Tue May 13 19:43:37 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=1555604514; cv=none; d=zoho.com; s=zohoarc; b=GS2iJQkzjtj6Asz4KAcOKn49gH7zn5X3yiP80MkzQsZgxpGOs2YJgySN9OcQelpPz02nRNH24p9sH1RgvkFFbStCuP//epggZbhJsQrzbftX1qw9C2QuifFar08hTMiDTkTSDAKD36xEtSal03EQq1VHxHFD6U2y1LIk/qRgzXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555604514; 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=DxOZsVwUemIJ5fHMoHKSaVGLt2jzylY4r2JGwgOkhbo=; b=kCLv4hrxis+WMjFrqjp2KkDm7xzn7lxU4UnSCxtYUlCffpCSBek5YhKgd3aM4ISyFc9vPBogYhkGyFzan0Q4/V6AdWjVnApEhmY+YnmyA+MJ1R95nqcw6r5uUk3rgMFffbdvuUhwk+wZZNqNNgqKg/XkTUrkonWSQFkrZZ1cq6Q= 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 1555604514381214.00796736551013; Thu, 18 Apr 2019 09:21:54 -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 31C1170D6B; Thu, 18 Apr 2019 16:21:53 +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 2749560851; Thu, 18 Apr 2019 16:21:53 +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 1E0514EA71; Thu, 18 Apr 2019 16:21:53 +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 x3IGLpt5009147 for ; Thu, 18 Apr 2019 12:21:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 88F7A60BEC; Thu, 18 Apr 2019 16:21:51 +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 DD74360BE5 for ; Thu, 18 Apr 2019 16:21:50 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 18 Apr 2019 18:21:37 +0200 Message-Id: <20190418162146.5695-2-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 01/10] api, patchew-cli: remove commands to directly access properties 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.28]); Thu, 18 Apr 2019 16:21:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" set-properties was completely unused; get-project-properties was not needed for the Javascript interface, only for the "project property" command. The Django admin is enough if one needs that kind of fine-grained access. --- api/views.py | 23 -------------------- patchew-cli | 61 ---------------------------------------------------- 2 files changed, 84 deletions(-) diff --git a/api/views.py b/api/views.py index 48a3587..d323ba3 100644 --- a/api/views.py +++ b/api/views.py @@ -111,16 +111,6 @@ class AddProjectView(APILoginRequiredView): p.save() =20 =20 -class GetProjectPropertiesView(APILoginRequiredView): - name =3D "get-project-properties" - - def handle(self, request, project): - po =3D Project.objects.get(name=3Dproject) - if not po.maintained_by(request.user): - raise PermissionDenied("Access denied to this project") - return po.get_properties() - - class UpdateProjectHeadView(APILoginRequiredView): name =3D "update-project-head" allowed_groups =3D ["importers"] @@ -135,19 +125,6 @@ class UpdateProjectHeadView(APILoginRequiredView): return ret =20 =20 -class SetPropertyView(APILoginRequiredView): - name =3D "set-properties" - allowed_groups =3D ["importers"] - - def handle(self, request, project, message_id, properties): - mo =3D Message.objects.filter(project__name=3Dproject, - message_id=3Dmessage_id).first() - if not mo: - raise Http404("Message not found") - for k, v in properties.items(): - mo.set_property(k, v) - - class SetProjectPropertiesView(APILoginRequiredView): name =3D "set-project-properties" allowed_groups =3D ["maintainers"] diff --git a/patchew-cli b/patchew-cli index 7fa7d49..efc6f13 100755 --- a/patchew-cli +++ b/patchew-cli @@ -346,42 +346,10 @@ class ProjectCommand(SubCommand): finally: shutil.rmtree(wd) =20 - def project_property(self, argv): - parser =3D argparse.ArgumentParser() - parser.add_argument("name", help=3D"Name of the project") - parser.add_argument("prop", nargs=3D"?", help=3D"Name of the prope= rty") - parser.add_argument("--delete", "-d", action=3D"store_true", - help=3D"""delete the property with the given n= ame. - Must give a property name""") - parser.add_argument("value", nargs=3D"?", help=3D"Value of the pro= perty to set") - args =3D parser.parse_args(argv) - if not args.value and not args.delete: - # Get property and print them or the specified one - r =3D self.api_do("get-project-properties", - project=3Dargs.name) - if not args.prop: - for k, v in iter(r.items()) if r else []: - print(k, v) - else: - if r and args.prop in r: - print(args.prop, r[args.prop]) - else: - print("Property Not found:", args.prop) - if r and list(r.keys()): - print("There are:", ", ".join(list(r.keys()))) - else: - if args.delete: - args.value =3D None - # Set property - self.api_do("set-project-properties", project=3Dargs.name, - properties=3D{args.prop: args.value}) - def do(self, args, argv): if argv: if argv[0] =3D=3D "add": return self.add_project(argv[1:]) - elif argv[0] =3D=3D "property": - return self.project_property(argv[1:]) elif argv[0] =3D=3D "info": return self.show_project(argv[1:]) elif argv[0] =3D=3D "update": @@ -420,35 +388,6 @@ class UntestCommand(SubCommand): self.api_do("untest", terms=3Dargs.term) return 0 =20 -class SetPropertyCommand(SubCommand): - name =3D "set-property" - want_argv =3D True - - def arguments(self, parser): - parser.add_argument("--project", "-p", required=3DTrue, - help=3D"Project name") - parser.add_argument("--message-id", "-m", required=3DTrue, - help=3D"Project name") - parser.add_argument("--file", action=3D"store_true", - help=3D"Read property values from given file") - parser.add_argument("--json", action=3D"store_true", - help=3D"Read property values as json") - - def do(self, args, argv): - if not argv: - return 0 - if len(argv) % 2: - print("Name and value unpaired:", argv[-1]) - props =3D dict(list(zip(argv[::2], argv[1::2]))) - if args.file: - props =3D dict([(k, open(v, "r").read()) for k, v in props.ite= ms()]) - if args.json: - props =3D dict([(k, json.loads(v)) for k, v in props.items()]) - self.api_do("set-properties", project=3Dargs.project, - message_id=3Dargs.message_id, - properties=3Dprops) - return 0 - class TesterCommand(SubCommand): name =3D "tester" want_argv =3D True --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel