File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -216,7 +216,8 @@ def event_processor(event, hint):
216216
217217 if _should_send_default_pii ():
218218 user_info = event .setdefault ("user" , {})
219- user_info ["ip_address" ] = get_client_ip (environ )
219+ if "ip_address" not in user_info :
220+ user_info ["ip_address" ] = get_client_ip (environ )
220221
221222 if "query_string" not in request_info :
222223 request_info ["query_string" ] = environ .get ("QUERY_STRING" )
Original file line number Diff line number Diff line change @@ -140,15 +140,17 @@ def _set_user_info(request, event):
140140 if user is None or not is_authenticated (user ):
141141 return
142142
143- try :
144- user_info ["email" ] = user .email
145- except Exception :
146- pass
143+ if "email" not in user_info :
144+ try :
145+ user_info ["email" ] = user .email
146+ except Exception :
147+ pass
147148
148- try :
149- user_info ["username" ] = user .get_username ()
150- except Exception :
151- pass
149+ if "username" not in user_info :
150+ try :
151+ user_info ["username" ] = user .get_username ()
152+ except Exception :
153+ pass
152154
153155
154156class _FormatConverter (object ):
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ def _add_user_to_event(event):
135135
136136 user_info = event .setdefault ("user" , {})
137137
138- if user_info . get ( "id" , None ) is None :
138+ if "id" not in user_info :
139139 try :
140140 user_info ["id" ] = user .get_id ()
141141 # TODO: more configurable user attrs here
You can’t perform that action at this time.
0 commit comments