From nobody Fri May 9 06:20:20 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=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520496058035154.87694374580292; Thu, 8 Mar 2018 00:00:58 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A01581DEA; Thu, 8 Mar 2018 08:00:57 +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 15E285C259; Thu, 8 Mar 2018 08:00:57 +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 08E47180613A; Thu, 8 Mar 2018 08:00:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2880tM0032382 for ; Thu, 8 Mar 2018 03:00:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 99FB6608F2; Thu, 8 Mar 2018 08:00:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 931C8614D0 for ; Thu, 8 Mar 2018 08:00:55 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) (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 719E880461 for ; Thu, 8 Mar 2018 08:00:54 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id w128so9550898wmw.0 for ; Thu, 08 Mar 2018 00:00:54 -0800 (PST) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id b9sm21755912wrh.68.2018.03.08.00.00.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Mar 2018 00:00:51 -0800 (PST) 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; bh=RtZu3nXQxYkEFoJbVuHwFeF/x+DI+yF7QWnj//Kw8ss=; b=dk9L7PddEtRq4v1/1wsaYMzQVAccXTvLbOvO++aUpae50BauTWplsrK3PWfQCBgTkC NtVivracDtO0HPnILOLTuCfUWgtYwtovO1N4VYOGyFj41t4W+RZ104nlFg1O4lOmJkFY 2B8MmHK9LcaP6/3t3DOwWno6tF35x0zpZbN79/GBvQTrLbgsorHAicrPRjvDoghwcHeO +jjlH0GbImvhVWL44is9NsW7GSJ9ytn1IYDVduvTf1uN79gPhWqRmVzmNXvVw2AA5iC+ SVKnAwMqHfUwWMlwKan4sT9qrsf6ZhpIsyLUCM9qdcdGTDB8bcpelwWSDI0eqixhoVpi msig== 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; bh=RtZu3nXQxYkEFoJbVuHwFeF/x+DI+yF7QWnj//Kw8ss=; b=pyjX5YMupQKTaey0iJNHd0lSzUyXXz/8O4BWeqABsbf1xAhPTGltX8ccli4JnFu00D Abi61ss7OPh9XljqhUNUqKMdt+JmCTBrIYfV8euF5qcQbdeK53PyPvCRjT8ci8HhkkNQ SnenXYV5r4mtTjlcsmxnihBerJP57A/p5wZLp/TOq2AVn4ckOOJFRp1emoGFnZueQnl0 znJHnnQMXIJkW7+maQ2Xrn8sqFxN0Q9CVxu0rCGqz11F4hYakDVPOvZBR5gCu+XqPOFM xgWkkJevIag6GACYuaUidekkInTV7iFOguzb8qgkig7/mUVAZSKFXzOHQ7es5/HQpVoN lVIQ== X-Gm-Message-State: AElRT7HdvMe334m1pAELCrKP/LujcoTTdbdK5ova+4L7mVGUKGAT+IQY PAZGuZqCJec/mVTxbvyzeHLRKZW4 X-Google-Smtp-Source: AG47ELtEIyUBvKrglIQKZDJAU1bTAQwtIcV+4sopmpwZzTLWNzLONmBCfC4kOhVqnzvSv+s7ghMv0g== X-Received: by 10.28.232.89 with SMTP id f86mr17479814wmh.72.1520496052682; Thu, 08 Mar 2018 00:00:52 -0800 (PST) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 8 Mar 2018 09:00:41 +0100 Message-Id: <20180308080042.19342-7-pbonzini@redhat.com> In-Reply-To: <20180308080042.19342-1-pbonzini@redhat.com> References: <20180308080042.19342-1-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 08:00:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 08 Mar 2018 08:00:54 +0000 (UTC) for IP:'74.125.82.67' DOMAIN:'mail-wm0-f67.google.com' HELO:'mail-wm0-f67.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.469 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.67 mail-wm0-f67.google.com 74.125.82.67 mail-wm0-f67.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 6/7] testing: add reverse_testing_log 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 08 Mar 2018 08:00:57 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Abstract the creation of testing log URLs. Signed-off-by: Paolo Bonzini --- mods/testing.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/mods/testing.py b/mods/testing.py index b822a34..ea6fdf5 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -146,6 +146,24 @@ class TestingModule(PatchewModule): TestingLogViewer.as_view(), name=3D"testing-log")) =20 + def reverse_testing_log(self, obj, test, request=3DNone, html=3DFalse): + if isinstance(obj, Message): + log_url =3D reverse("testing-log", + kwargs=3D{"project_or_series": obj.message_i= d, + "testing_name": test}) + "?type=3Dme= ssage" + else: + assert(isinstance(obj, Project)) + log_url =3D reverse.reverse("testing-log", + kwargs=3D{"project_or_series": obj.name, + "testing_name": test}) + "?type=3Dpr= oject" + if html: + log_url +=3D "&html=3D1" + # Generate a full URL, including the host and port, for use in ema= il + # notifications and REST API responses. + if request: + log_url =3D request.build_absolute_uri(log_url) + return log_url + def add_test_report(self, user, project, tester, test, head, base, identity, passed, log, is_timeout): # Find a project or series depending on the test type and assign i= t to obj @@ -203,20 +221,8 @@ class TestingModule(PatchewModule): continue tn =3D pn[len("testing.report."):] failed =3D not p["passed"] - log_prop =3D "testing.log." + tn - if isinstance(obj, Message): - typearg =3D "type=3Dmessage" - log_url =3D reverse("testing-log", - kwargs=3D{"project_or_series": obj.messa= ge_id, - "testing_name": tn}) - else: - assert(isinstance(obj, Project)) - typearg =3D "type=3Dproject" - log_url =3D reverse("testing-log", - kwargs=3D{"project_or_series": obj.name, - "testing_name": tn}) - log_url +=3D "?" + typearg - html_log_url =3D log_url + "&html=3D1" + log_url =3D self.reverse_testing_log(obj, tn, html=3DFalse) + html_log_url =3D self.reverse_testing_log(obj, tn, html=3DTrue) passed_str =3D "failed" if failed else "passed" html =3D format_html('Test {} {}', tn, html_log_url, log_url, passed_str) @@ -263,12 +269,7 @@ class TestingModule(PatchewModule): continue tn =3D pn[len("testing.report."):] failed =3D not p["passed"] - log_prop =3D "testing.log." + tn - typearg =3D "type=3Dmessage" - log_url =3D reverse("testing-log", - kwargs=3D{"project_or_series": message.messa= ge_id, - "testing_name": tn}) - log_url +=3D "?" + typearg + log_url =3D self.reverse_testing_log(message, tn, request=3Dre= quest, html=3DFalse) passed_str =3D "failure" if failed else "success" result =3D { 'status': passed_str, --=20 2.14.3 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel