Skip to content

Commit e7efa19

Browse files
committed
better
1 parent 535a9e8 commit e7efa19

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sentry_sdk/integrations/django/templates.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,25 @@ def _normalize_context(context):
6767
{}
6868
) # type: Dict[str, Union[str, int, float, bool, type(None), list[Union[str, int, float, bool, type(None)]], dict[str, Union[str, int, float, bool, type(None)]]]]
6969
for key, value in context.items():
70+
if isinstance(value, (str, int, float, bool, type(None))):
71+
new_context[key] = value
72+
continue
73+
7074
if isinstance(value, list):
7175
new_context[key] = [
7276
item
7377
for item in value
7478
if isinstance(item, (str, int, float, bool, type(None)))
7579
]
76-
elif isinstance(value, dict):
80+
continue
81+
82+
if isinstance(value, dict):
7783
new_context[key] = {
7884
k: v
7985
for k, v in value.items()
8086
if isinstance(v, (str, int, float, bool, type(None)))
8187
}
82-
elif isinstance(value, (str, int, float, bool, type(None))):
83-
new_context[key] = value
88+
continue
8489

8590
return new_context
8691

0 commit comments

Comments
 (0)