events: fix sanitize_dict not working on list items
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
ad1f913e54
commit
4d9c9160e7
|
@ -38,6 +38,9 @@ def cleanse_dict(source: dict[Any, Any]) -> dict[Any, Any]:
|
||||||
final_dict[key] = value
|
final_dict[key] = value
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
final_dict[key] = cleanse_dict(value)
|
final_dict[key] = cleanse_dict(value)
|
||||||
|
elif isinstance(value, list):
|
||||||
|
for idx, item in enumerate(value):
|
||||||
|
value[idx] = cleanse_dict(item)
|
||||||
return final_dict
|
return final_dict
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,6 +91,9 @@ def sanitize_dict(source: dict[Any, Any]) -> dict[Any, Any]:
|
||||||
value = asdict(value)
|
value = asdict(value)
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
final_dict[key] = sanitize_dict(value)
|
final_dict[key] = sanitize_dict(value)
|
||||||
|
elif isinstance(value, list):
|
||||||
|
for idx, item in enumerate(value):
|
||||||
|
value[idx] = sanitize_dict(item)
|
||||||
elif isinstance(value, (User, AnonymousUser)):
|
elif isinstance(value, (User, AnonymousUser)):
|
||||||
final_dict[key] = sanitize_dict(get_user(value))
|
final_dict[key] = sanitize_dict(get_user(value))
|
||||||
elif isinstance(value, models.Model):
|
elif isinstance(value, models.Model):
|
||||||
|
|
Reference in New Issue