Skip to content

Commit d299bb3

Browse files
authored
Fix: request handler, temporary do not get user from thread local. (#146)
1 parent d1b386f commit d299bb3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

easyaudit/signals/request_signals.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from django.conf import settings
77
from django.utils.module_loading import import_string
88

9-
from easyaudit.middleware.easyaudit import get_current_user
9+
# try and get the user from the request; commented for now, may have a bug in this flow.
10+
# from easyaudit.middleware.easyaudit import get_current_user
1011
from easyaudit.settings import REMOTE_ADDR_HEADER, UNREGISTERED_URLS, REGISTERED_URLS, WATCH_REQUEST_EVENTS, \
1112
LOGGING_BACKEND
1213

@@ -38,8 +39,9 @@ def request_started_handler(sender, environ, **kwargs):
3839
if not should_log_url(environ['PATH_INFO']):
3940
return
4041

41-
# try and get the user from the request
42-
user = get_current_user()
42+
# try and get the user from the request; commented for now, may have a bug in this flow.
43+
# user = get_current_user()
44+
user = None
4345
# get the user from cookies
4446
if not user and environ.get('HTTP_COOKIE'):
4547
cookie = SimpleCookie() # python3 compatibility

easyaudit/tests/test_app/tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import json
33
import re
4+
from unittest import skip
45

56
from django.test import TestCase, override_settings
67
from unittest.mock import patch
@@ -136,6 +137,7 @@ def test_manual_set_user(self):
136137
crud_event = crud_event_qs[0]
137138
self.assertEqual(crud_event.user, None)
138139

140+
@skip("Test may need a rewrite but the library logic has been rolled back.")
139141
def test_middleware_logged_in_user_in_request(self):
140142
user = self._setup_user(TEST_USER_EMAIL, TEST_USER_PASSWORD)
141143
self.client.force_login(user)

0 commit comments

Comments
 (0)