diff --git a/gcloud/core/views.py b/gcloud/core/views.py index f36b78e03..71e00b8f2 100644 --- a/gcloud/core/views.py +++ b/gcloud/core/views.py @@ -30,16 +30,11 @@ logger = logging.getLogger("root") -def get_response(request): - # 这是一个假函数,用于模拟正常的 get_response 逻辑 - return None - - def page_not_found(request, exception): if request.path.startswith(settings.STATIC_URL): return HttpResponseNotFound() - user = LoginRequiredMiddleware(get_response).authenticate(request) + user = LoginRequiredMiddleware(lambda x: None).authenticate(request) if user: request.user = user @@ -49,8 +44,8 @@ def page_not_found(request, exception): return render(request, "core/base_vue.html", {}) # 未登录重定向到首页,跳到登录页面 - if hasattr(LoginRequiredMiddleware(get_response), "is_user_forbidden"): - user_forbidden, msg = LoginRequiredMiddleware(get_response).is_user_forbidden(request) + if hasattr(LoginRequiredMiddleware(lambda x: None), "is_user_forbidden"): + user_forbidden, msg = LoginRequiredMiddleware(lambda x: None).is_user_forbidden(request) if user_forbidden: handler = ResponseHandler(ConfFixture, settings) return handler.build_403_response(msg)