Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serialize __proxy__ objects before logging #624

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

Nathan-Cohen
Copy link
Contributor

Hello,
I created this Pull Request in response to the user's request regarding the logging issue related to django translation before logging (#606). I've encountered the problem myself and I think the easiest way is to make a correction in the library.

Example :

instance = MyInstance(name=_('test_value'))
instance.save()

Error encountered : TypeError: Object of type __proxy__ is not JSON serializable

I think this is more of a bug than an improvement.

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.25%. Comparing base (5289482) to head (546e5d3).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #624      +/-   ##
==========================================
+ Coverage   95.21%   95.25%   +0.03%     
==========================================
  Files          31       31              
  Lines        1025     1033       +8     
==========================================
+ Hits          976      984       +8     
  Misses         49       49              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hramezani
Copy link
Member

Thanks @Nathan-Cohen for the PR.
Please add a test and change log

@Nathan-Cohen Nathan-Cohen force-pushed the serializer-proxy-objects branch 2 times, most recently from f80223d to 408b649 Compare April 8, 2024 08:18
@Nathan-Cohen
Copy link
Contributor Author

Nathan-Cohen commented Apr 8, 2024

@hramezani it's done, I've added the tests and the changelog

CHANGELOG.md Outdated
@@ -9,6 +9,7 @@
- feat: If any receiver returns False, no logging will be made. This can be useful if logging should be conditionally enabled / disabled ([#590](https://github.com/jazzband/django-auditlog/pull/590))
- Django: Confirm Django 5.0 support ([#598](https://github.com/jazzband/django-auditlog/pull/598))
- Django: Drop Django 4.1 support ([#598](https://github.com/jazzband/django-auditlog/pull/598))
- Fixed logging problem related to django translation before logging ([#624](https://github.com/jazzband/django-auditlog/pull/624))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please move it up. this shouldn't be under 3.0.0-beta.4 that is already released

@hramezani
Copy link
Member

Thanks @Nathan-Cohen. just a small comment and then we are ready to merge

CHANGELOG.md Show resolved Hide resolved
@hramezani hramezani merged commit a93d9ef into jazzband:master Apr 8, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants