Skip to content
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
3 changes: 2 additions & 1 deletion sentry_sdk/integrations/_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ def event_processor(event, hint):

if _should_send_default_pii():
user_info = event.setdefault("user", {})
user_info["ip_address"] = get_client_ip(environ)
if "ip_address" not in user_info:
user_info["ip_address"] = get_client_ip(environ)

if "query_string" not in request_info:
request_info["query_string"] = environ.get("QUERY_STRING")
Expand Down
18 changes: 10 additions & 8 deletions sentry_sdk/integrations/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,17 @@ def _set_user_info(request, event):
if user is None or not is_authenticated(user):
return

try:
user_info["email"] = user.email
except Exception:
pass
if "email" not in user_info:
try:
user_info["email"] = user.email
except Exception:
pass

try:
user_info["username"] = user.get_username()
except Exception:
pass
if "username" not in user_info:
try:
user_info["username"] = user.get_username()
except Exception:
pass


class _FormatConverter(object):
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _add_user_to_event(event):

user_info = event.setdefault("user", {})

if user_info.get("id", None) is None:
if "id" not in user_info:
try:
user_info["id"] = user.get_id()
# TODO: more configurable user attrs here
Expand Down