From nobody Mon May 13 00:29:12 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154030376964346.26585074062655; Tue, 23 Oct 2018 07:09:29 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 6F0F3C04BD2E; Tue, 23 Oct 2018 14:09:28 +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 5FE6927C3F; Tue, 23 Oct 2018 14:09:28 +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 4E6834CAA7; Tue, 23 Oct 2018 14:09:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9NE1PWX003353 for ; Tue, 23 Oct 2018 10:01:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id E391A7A487; Tue, 23 Oct 2018 14:01:25 +0000 (UTC) Received: from magic.redhat.com (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id C22717A490 for ; Tue, 23 Oct 2018 14:01:24 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Tue, 23 Oct 2018 22:01:15 +0800 Message-Id: <20181023140115.28810-2-famz@redhat.com> In-Reply-To: <20181023140115.28810-1-famz@redhat.com> References: <20181023140115.28810-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 1/1] debug: Enable debug toolbar for superuser in production deploy 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 23 Oct 2018 14:09:28 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- patchew/settings.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/patchew/settings.py b/patchew/settings.py index 65a3b29..cea5187 100644 --- a/patchew/settings.py +++ b/patchew/settings.py @@ -128,9 +128,8 @@ BLOB_DIR =3D os.path.join(DATA_DIR, "blob") if not os.path.isdir(BLOB_DIR): os.mkdir(BLOB_DIR) =20 -if DEBUG: - INSTALLED_APPS +=3D ['debug_toolbar'] - MIDDLEWARE +=3D ['debug_toolbar.middleware.DebugToolbarMiddleware'] +INSTALLED_APPS +=3D ['debug_toolbar'] +MIDDLEWARE +=3D ['debug_toolbar.middleware.DebugToolbarMiddleware'] =20 MEDIA_ROOT =3D os.path.join(DATA_DIR, "media") MEDIA_URL =3D "/media/" @@ -220,3 +219,10 @@ if not DEBUG: }, }, } + +def debug_toolbar_check(request): + return request.user.is_superuser + +DEBUG_TOOLBAR_CONFIG =3D { + 'SHOW_TOOLBAR_CALLBACK': debug_toolbar_check, +} --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel