From ab8b37a89990afcd1e223bfcd66bc29ce8a3c2b9 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 25 Apr 2022 11:12:57 +0200 Subject: [PATCH] events: fix ignored instances not being a tuple Signed-off-by: Jens Langhammer --- authentik/events/middleware.py | 6 +++--- authentik/root/settings.py | 4 +--- authentik/root/urls.py | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/authentik/events/middleware.py b/authentik/events/middleware.py index 2405fe4a5..0c9be762c 100644 --- a/authentik/events/middleware.py +++ b/authentik/events/middleware.py @@ -25,11 +25,11 @@ IGNORED_MODELS = [ AuthenticatedSession, StaticToken, ] -try: +if settings.DEBUG: from silk.models import Request, Response + IGNORED_MODELS += [Request, Response] -except: - pass +IGNORED_MODELS = tuple(IGNORED_MODELS) class AuditMiddleware: diff --git a/authentik/root/settings.py b/authentik/root/settings.py index 9fe5cf5b1..5375e0089 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -506,9 +506,7 @@ if DEBUG: os.environ[ENV_GIT_HASH_KEY] = "dev" INSTALLED_APPS.append("silk") SILKY_PYTHON_PROFILER = True - MIDDLEWARE = [ - "silk.middleware.SilkyMiddleware" - ] + MIDDLEWARE + MIDDLEWARE = ["silk.middleware.SilkyMiddleware"] + MIDDLEWARE INSTALLED_APPS.append("authentik.core") diff --git a/authentik/root/urls.py b/authentik/root/urls.py index dfa1dde68..6a7385d28 100644 --- a/authentik/root/urls.py +++ b/authentik/root/urls.py @@ -1,7 +1,7 @@ """authentik URL Configuration""" +from django.conf import settings from django.urls import include, path from structlog.stdlib import get_logger -from django.conf import settings from authentik.core.views import error from authentik.lib.utils.reflection import get_apps