From 519e9ae39db442acab2de5d1fdeb7b6b58ee1653 Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 10 Nov 2025 14:35:30 +0530 Subject: [PATCH] [FIX] HORILLA: Fixed integration enabled decorator if no request exist --- horilla/decorators.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/horilla/decorators.py b/horilla/decorators.py index 165e774e7..5ed36d580 100755 --- a/horilla/decorators.py +++ b/horilla/decorators.py @@ -477,25 +477,27 @@ def check_integration_enabled(func, app_name): from base.models import IntegrationApps @wraps(func) - def wrapper(request, *args, **kwargs): + def wrapper(request=None, *args, **kwargs): if not IntegrationApps.objects.filter( app_label=app_name, is_enabled=True ).exists(): - try: - app_config = apps.get_app_config(app_name) - app_verbose_name = app_config.verbose_name - except LookupError: - app_verbose_name = app_name + if request: + try: + app_config = apps.get_app_config(app_name) + app_verbose_name = app_config.verbose_name + except LookupError: + app_verbose_name = app_name - messages.error(request, f"Access to '{app_verbose_name}' is disabled.") + messages.error(request, f"Access to '{app_verbose_name}' is disabled.") - previous_url = request.META.get("HTTP_REFERER", "/") + previous_url = request.META.get("HTTP_REFERER", "/") - if "HTTP_HX_REQUEST" in request.META: - return render(request, "decorator_404.html") + if "HTTP_HX_REQUEST" in request.META: + return render(request, "decorator_404.html") - script = f'' - return HttpResponse(script) + script = f'' + return HttpResponse(script) + return None return func(request, *args, **kwargs)