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.
This commit is contained in:
Feanil Patel
2021-04-01 10:25:46 -04:00
parent 5b7caf45d6
commit 23f2b758d4

View File

@@ -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