From nobody Mon Sep 16 19:12:10 2024 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=patchew-devel-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601048916; cv=none; d=zohomail.com; s=zohoarc; b=la2W389BaM2ImxIK/SLX6NIPnWGh1ZK6qxTL0T7bFxxeftP1zWDHPH2w/3yfalaP/b4lYr7utipWivMkCzxyV/SbNV+rIOm+8YHKJglUMoXmtceVkghvKN5od+mJ9puNRlKJvbLGyMLgKgKELe9v2s7S7YUgNJcc+4Bk2qBZNaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601048916; 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=ZawyAEV2mw79hdgOb2b7g5Glvmmowm1USPGSxwZ6HT4=; b=gprzWt6F6/IJouw+2bU4LOYsJw+tNVkpNBVmoLCWRJNBQq3ckcWNIAi9pWmxB0nXMrbYgDxgGLVtWylF5/5K0gUOihdWkwj+qbdpOkVV4gwgrprBPpNHq0H7m8cN5zM38Ucre/Bmsor56MmWMqQhmKNAdwP/MqxA+aJRfLUNxYA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601048916969399.64769367554663; Fri, 25 Sep 2020 08:48:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-501-4KizAo8WMliBWNt2dJuFCg-1; Fri, 25 Sep 2020 11:48:32 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1996F1007B01; Fri, 25 Sep 2020 15:48:31 +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 1005919C78; Fri, 25 Sep 2020 15:48:31 +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 04FDF1826D2B; Fri, 25 Sep 2020 15:48:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08PFj2JU024493 for ; Fri, 25 Sep 2020 11:45:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id F2F4C2022792; Fri, 25 Sep 2020 15:45:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE1E52022794 for ; Fri, 25 Sep 2020 15:44:59 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C7E4811E78 for ; Fri, 25 Sep 2020 15:44:59 +0000 (UTC) Received: from sender2-op-o12.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-W8wOnLwZNpuRusFXSANOZQ-1; Fri, 25 Sep 2020 11:44:50 -0400 Received: from localhost (host109-159-73-6.range109-159.btcentralplus.com [109.159.73.6]) by mx.zoho.com.cn with SMTPS id 1601048682020824.6165593448337; Fri, 25 Sep 2020 23:44:42 +0800 (CST) X-MC-Unique: 4KizAo8WMliBWNt2dJuFCg-1 X-MC-Unique: W8wOnLwZNpuRusFXSANOZQ-1 From: fam@euphon.net To: patchew-devel@redhat.com Message-ID: <20200925154243.685513-7-fam@euphon.net> Date: Fri, 25 Sep 2020 16:42:38 +0100 In-Reply-To: <20200925154243.685513-1-fam@euphon.net> References: <20200925154243.685513-1-fam@euphon.net> MIME-Version: 1.0 X-ZohoCNMailClient: External X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Mimecast-Spam-Signature: yes X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 08PFj2JU024493 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 06/11] rest: Allow schema generation code to invoke serializer 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.84 on 10.5.11.23 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 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Returning Http404 for real request is intended, but we also get called from schema generators which doesn't pass any projects_pk. So only reject if a key is provided. --- api/rest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/rest.py b/api/rest.py index 3a9def5..2e9297a 100644 --- a/api/rest.py +++ b/api/rest.py @@ -406,8 +406,8 @@ class ProjectMessagesViewSetMixin(mixins.RetrieveModelM= ixin, mixins.UpdateModelM return self.__project =20 def get_serializer_context(self): - if self.project is None: - raise Http404 + if "projects_pk" in self.kwargs and not self.project: + raise Http404("Project not found") context =3D super(ProjectMessagesViewSetMixin, self).get_serialize= r_context() context["project"] =3D self.project return context --=20 2.25.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel