Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(django): capture user name and id #176

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG](http://keepachangelog.com/) for how to update this file. This project
adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
- Django: Fix for automatically capturing user id and user name when available

## [0.20.1] - 2024-06-14
- Fix: Resolve "can't pickle '_io.TextIOWrapper' object" error (#173)
Expand Down
4 changes: 2 additions & 2 deletions examples/django_app/honeybadger_example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
]

MIDDLEWARE = [
# Honeybadger middleware goes to the top
'honeybadger.contrib.DjangoHoneybadgerMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# Add honeybadger middleware
'honeybadger.contrib.DjangoHoneybadgerMiddleware',
]

ROOT_URLCONF = 'honeybadger_example.urls'
Expand Down
2 changes: 1 addition & 1 deletion honeybadger/contrib/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def __init__(self, get_response=None):
def __call__(self, request):
set_request(request)
honeybadger.begin_request(request)
self.__set_user_from_context(request)

response = self.get_response(request)

Expand All @@ -126,6 +125,7 @@ def __call__(self, request):
return response

def process_exception(self, request, exception):
self.__set_user_from_context(request)
honeybadger.notify(exception)
clear_request()
return None
Expand Down
Loading