Skip to content

Commit

Permalink
Fix serialize __proxy__ objects before logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan-Cohen committed Apr 4, 2024
1 parent a0ae594 commit cd09213
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions auditlog/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def get_field_value(obj, field):
)
else:
value = smart_str(getattr(obj, field.name, None))
if type(value).__name__ == "__proxy__":
value = str(value)

Check warning on line 86 in auditlog/diff.py

View check run for this annotation

Codecov / codecov/patch

auditlog/diff.py#L86

Added line #L86 was not covered by tests
except ObjectDoesNotExist:
value = (
field.default
Expand Down

0 comments on commit cd09213

Please sign in to comment.