From nobody Sun Jan 5 06:09:38 2025 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1533726774214988.2611906135584; Wed, 8 Aug 2018 04:12:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6B693001C32; Wed, 8 Aug 2018 11:12:52 +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 B536E9CF0B; Wed, 8 Aug 2018 11:12:52 +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 A61434BB78; Wed, 8 Aug 2018 11:12:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w78BCpfU003408 for ; Wed, 8 Aug 2018 07:12:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 76D312010CC6; Wed, 8 Aug 2018 11:12:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D32F2010CA0 for ; Wed, 8 Aug 2018 11:12:49 +0000 (UTC) Received: from mail-pl0-f51.google.com (mail-pl0-f51.google.com [209.85.160.51]) (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 5B555C049D64 for ; Wed, 8 Aug 2018 11:12:48 +0000 (UTC) Received: by mail-pl0-f51.google.com with SMTP id e11-v6so896625plb.3 for ; Wed, 08 Aug 2018 04:12:48 -0700 (PDT) Received: from localhost.localdomain ([182.74.40.122]) by smtp.gmail.com with ESMTPSA id 1-v6sm11432969pfk.134.2018.08.08.04.12.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Aug 2018 04:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=E1w/BchjZ1S5EWzDP0ndqTkih8TkBJD4sU9bAk/67qE=; b=Jk0HVVNPLrPTgjsR3z8IY9rFBXEsNwhyQZm+HjqVKoJ5DlQHVWBRmEswSH4Zj1tgHJ vu1dOPCjvETJbYe3ZhPi7ic5P7sUmIVZmdETecPW9uU/aHYCfP/zp8XhKMvWsxUsb+Qi tkNHMSxJUkDcWVklNtKt2HMNkQMskk9S3gun/kOTk7rK0YxhcYZqpiOOZ/SVvNgRpcqW nS3PQARtk656JpDTjvZz3ms8JXBfte8HaSkkkKuihlyJtu7v8VVXk+bqE/jgKhkDfPg3 ocZ0FZ04gq+8S1aWbNAuNRnJ356nlEvdNOQexgZTPgGMYy54inlnqt17QPRy/UUpENG3 ItFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=E1w/BchjZ1S5EWzDP0ndqTkih8TkBJD4sU9bAk/67qE=; b=FjsCbel2nbWTFwy9fONXRc0QU1d/3pIwPiaJVtuC9IlCGM8pmFs914lxMcVdC9ocx1 0yFMbfl19pMnuzGfPwR2n7dqIJoHiLCeub+uejZ0cJU7c/9n/TS38d2t7qJiCZvoEYqq aECnDZWSqYx49DHMtVfdAZhmxdtT8dqW9A7yrW4WfT5OC/OfoU09lYhYVfl+HC4xHbDH 9BbELNoVbtZfuJi6iH0luX3eRhVw6QF0llwp7Y0lmSvG8q3YiBSufBjhNc1eQ+9Jm5/k nWaqzqB2GJ0XzCeQZAtUfUbiPYrZVXeX9ya/hBwTrioioVbRxn1mprXWpkSSW7pWLap8 l3UA== X-Gm-Message-State: AOUpUlFnGFdmBr2liDHg1dR6suzZ7sXxjR4reJj7ZnumwNlGtWzQLWi2 80FMD4p5Of2UoFmLA0Fan0IIkaJkrLE= X-Google-Smtp-Source: AA+uWPzpnfm6Kk0rqGRZLHnwnD3kyefx5YoflXqKw2TTVsz4hr+orlNNZMwDdZn4V+qNTSVHjOcvWA== X-Received: by 2002:a17:902:6b44:: with SMTP id g4-v6mr2190757plt.50.1533726767317; Wed, 08 Aug 2018 04:12:47 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Wed, 8 Aug 2018 16:42:25 +0530 Message-Id: <20180808111226.55535-3-shubhamjain7495@gmail.com> In-Reply-To: <20180808111226.55535-1-shubhamjain7495@gmail.com> References: <20180808111226.55535-1-shubhamjain7495@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 08 Aug 2018 11:12:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 08 Aug 2018 11:12:48 +0000 (UTC) for IP:'209.85.160.51' DOMAIN:'mail-pl0-f51.google.com' HELO:'mail-pl0-f51.google.com' FROM:'shubhamjain7495@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.160.51 mail-pl0-f51.google.com 209.85.160.51 mail-pl0-f51.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH 2/3] add support for result PUT to mods/* 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 08 Aug 2018 11:12:52 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Added serializer to validate data field in the PUT of the result --- mods/git.py | 11 ++++++++++- mods/testing.py | 10 ++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mods/git.py b/mods/git.py index 924547a..0e1de86 100644 --- a/mods/git.py +++ b/mods/git.py @@ -23,6 +23,9 @@ from api.rest import PluginMethodField from api.views import APILoginRequiredView, prepare_series from patchew.logviewer import LogView from schema import * +from rest_framework import serializers +from rest_framework import serializers +from rest_framework.fields import CharField =20 _instance =3D None =20 @@ -42,11 +45,17 @@ class GitLogViewer(LogView): raise Http404("Object not found: " + series) return obj.git_result =20 +class DataSerializer(serializers.Serializer): + repo =3D CharField() + url =3D CharField() + base =3D CharField() + tag =3D CharField() =20 class GitModule(PatchewModule): """Git module""" name =3D "git" - + allowed_groups =3D ('importers', ) + result_data_serializer_class =3D DataSerializer project_property_schema =3D \ ArraySchema("git", desc=3D"Configuration for git module", members=3D[ diff --git a/mods/testing.py b/mods/testing.py index 0a80b3d..37831b7 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -24,7 +24,8 @@ from api.search import SearchEngine from event import emit_event, declare_event, register_handler from patchew.logviewer import LogView from schema import * - +from rest_framework import serializers +from rest_framework.fields import CharField, BooleanField _instance =3D None =20 TESTING_SCRIPT_DEFAULT =3D """#!/bin/bash @@ -46,12 +47,17 @@ class TestingLogViewer(LogView): raise Http404("Object not found: " + project_or_series) return _instance.get_testing_result(obj, testing_name) =20 +class DataSerializer(serializers.Serializer): + is_timeout =3D BooleanField() + head =3D CharField() + tester =3D CharField() =20 class TestingModule(PatchewModule): """Testing module""" =20 name =3D "testing" - + allowed_groups =3D ('testers', ) + result_data_serializer_class =3D DataSerializer test_schema =3D \ ArraySchema("{name}", "Test", desc=3D"Test spec", members=3D[ --=20 2.15.1 (Apple Git-101) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel