You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking into a way to address #165 and noticed that the request is None in _thread_locals. This seems to be a bug (causing the extra work to retrieve the user in request_started). It also means that the user cannot be retrieved from the request in request_started.
It looks like the request is stored and immediately after deleted from the locals object in the middleware.
_thread_locals.request=request# seems redundant w/process_request, but keeping in for now.
ifhasattr(self, 'process_request'):
response=self.process_request(request)
response=responseorself.get_response(request)
ifhasattr(self, 'process_response'):
response=self.process_response(request, response)
returnresponse
The order of execution is actually:
request_started signal triggered
EasyAuditMiddleware called
I saw in django-structlog that there are custom signals (foo = django.dispatch.Signal()) being used which are triggered from the middleware. This would allow for more fine-grained control.
I am looking into a way to address #165 and noticed that the
request
isNone
in_thread_locals
. This seems to be a bug (causing the extra work to retrieve the user inrequest_started
). It also means that the user cannot be retrieved from the request inrequest_started
.It looks like the
request
is stored and immediately after deleted from the locals object in the middleware.See:
django-easy-audit/easyaudit/middleware/easyaudit.py
Lines 49 to 56 in 0c98c56
The order of execution is actually:
request_started
signal triggeredEasyAuditMiddleware
calledI saw in
django-structlog
that there are custom signals (foo = django.dispatch.Signal()
) being used which are triggered from the middleware. This would allow for more fine-grained control.So maybe something like the following could work:
The text was updated successfully, but these errors were encountered: