From 23f2b758d414e95c84313c87e9f03e8db4902bca Mon Sep 17 00:00:00 2001 From: Feanil Patel <feanil@edx.org> Date: Thu, 1 Apr 2021 10:25:46 -0400 Subject: [PATCH] fix: Print more stack frames on requset tracing. Six frames was not enough because for DRF views the request gets wrapped in a proxy object and so we need more of the stack to see what part of the code we're in that actually invokes the use change. --- openedx/core/djangoapps/safe_sessions/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/safe_sessions/middleware.py b/openedx/core/djangoapps/safe_sessions/middleware.py index 6b551ccb702..23559805b17 100644 --- a/openedx/core/djangoapps/safe_sessions/middleware.py +++ b/openedx/core/djangoapps/safe_sessions/middleware.py @@ -535,7 +535,7 @@ def log_request_user_changes(request): if name == 'user': stack = inspect.stack() # Written this way in case you need more of the stack for debugging. - location = "\n".join("%30s : %s:%d" % (t[3], t[1], t[2]) for t in stack[0:6]) + location = "\n".join("%30s : %s:%d" % (t[3], t[1], t[2]) for t in stack[0:12]) if not hasattr(request, name): original_user = value -- GitLab