From nobody Fri Apr 26 16:35:05 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; 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=1555403077; cv=none; d=zoho.com; s=zohoarc; b=XoF3sBsMv1zpz6VFMqhjCfpqFxJ939vleCq9qDICftyZIjJCY5ixgMHKwNOWdddgAtpptXFYdLoujTpQpKvDGqD8wzqVjdUeWxgOGhw/xeGxrAR7bCiMBR3OQbluCXkCOfvcV+8xkFNMB7w3TJ658HjHnR/GQPe7wt5N6Q59Tck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555403077; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=h034C/802eNWrDrQYtoL7TqIJyHdMWCpag8DOtRTLIk=; b=bNOfXOSHG05+SX5fqcRUXgYptm8XOHvHRef7Df+B8dVusbg4q+kvWIO58nRwdT2cxgXAcNZk2LSLnOgDZrVEFVzWiFHNJVFDdZpy43hn5aKKf1Q0Czm9cUh2aECBQ8+O1MTuWI9cVhbtAMDHQTXFovD9NKhUI4+6ETroU53aPXk= 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 1555403077677884.3889172661237; Tue, 16 Apr 2019 01:24:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32AA36697A; Tue, 16 Apr 2019 08:24:31 +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 291EA5D707; Tue, 16 Apr 2019 08:24: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 1F21441F3D; Tue, 16 Apr 2019 08:24:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3G8Nwh2020724 for ; Tue, 16 Apr 2019 04:23:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 94E465D71B; Tue, 16 Apr 2019 08:23:58 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-44.ams2.redhat.com [10.36.112.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA5645D71A for ; Tue, 16 Apr 2019 08:23:55 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 16 Apr 2019 10:23:54 +0200 Message-Id: <20190416082354.4753-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] fix remaining 500 occurrences 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 16 Apr 2019 08:24:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" With template logs disabled, the error logs are actually readable and it is possible to sift through them and fix all the remaining occurrences of internal server errors (exceptions during request processing). Signed-off-by: Paolo Bonzini --- api/models.py | 2 +- mods/diff.py | 2 ++ mods/maintainer.py | 1 + patchew/logviewer.py | 2 +- www/views.py | 2 ++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/models.py b/api/models.py index b4a6e9e..aa99eb8 100644 --- a/api/models.py +++ b/api/models.py @@ -673,7 +673,7 @@ class Message(models.Model): d.day, d.hour, d.minute, d.second, d.year) =20 def get_last_reply_age(self): - return self._get_age(self.last_reply_date) + return self._get_age(self.last_reply_date or self.date) =20 def get_body(self): return self.get_mbox_obj().get_body() diff --git a/mods/diff.py b/mods/diff.py index 4896f41..a44b637 100644 --- a/mods/diff.py +++ b/mods/diff.py @@ -110,6 +110,8 @@ class DiffModule(PatchewModule): def www_view_series_diff(self, request, project, series_left, series_r= ight): sl =3D Message.objects.filter(project__name=3Dproject, message_id= =3Dseries_left) sr =3D Message.objects.filter(project__name=3Dproject, message_id= =3Dseries_right) + if sl is None or sr is None: + raise Http404("Series not found") return render_page(request, "series-diff.html", series_left=3Dself._get_series_for_diff(sl), series_right=3Dself._get_series_for_diff(sr)) diff --git a/mods/maintainer.py b/mods/maintainer.py index 4d02dba..7093760 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -10,6 +10,7 @@ =20 import re from django.conf.urls import url +from django.core.exceptions import PermissionDenied from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequ= est from django.urls import reverse from mod import PatchewModule diff --git a/patchew/logviewer.py b/patchew/logviewer.py index f986727..646171c 100644 --- a/patchew/logviewer.py +++ b/patchew/logviewer.py @@ -12,7 +12,7 @@ import abc import sys =20 from django.views import View -from django.http import HttpResponse, StreamingHttpResponse +from django.http import HttpResponse, StreamingHttpResponse, Http404 from django.utils.safestring import mark_safe =20 class ANSIProcessor(object): diff --git a/www/views.py b/www/views.py index c8570ca..f48a8ce 100644 --- a/www/views.py +++ b/www/views.py @@ -361,6 +361,8 @@ def view_series_message(request, project, thread_id, me= ssage_id): if not s: raise Http404("Series not found") m =3D api.models.Message.objects.filter(message_id=3Dmessage_id, in_re= ply_to=3Dthread_id).first() + if not m: + raise Http404("Message not found") nav_path =3D prepare_navigate_list( "View patch", ("series_list", {"project": project}, project), --=20 2.21.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel