Opened 18 months ago

Last modified 18 months ago

#34644 closed Uncategorized

`get_prep_value` now being called for JSONField — at Version 1

Reported by: Shaheed Haque Owned by: nobody
Component: Database layer (models, ORM) Version: 4.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Shaheed Haque)

#34539 introduced a change to 4.2.2 which seems to have broken the social_django code I use. AFAIK, the old behaviour was present well before the apparent regression noted in #34539 between 4.1 and 4.2.

I'm not especially knowledgeable about the issues debated above, but here is what I see. First, social_django sets a JSONField extra_data and then saves the value here:

https://github.com/python-social-auth/social-app-django/blob/8d0a2052d1b22a899454571c62237d23aa25af97/social_django/storage.py#L24

Second, on the stack, I have the frames shown in the attachment "stack frames". The important point is that when I enter the two new lines of code added in #34539, value is a dict, but is flattened into a string by the new code. The result is that the database JSONField has the saved string while previously, the dict was saved as expected. I believe that to be incorrect.

(Perhaps the intent here was to only have this change apply to subclasses of JSONField?)

Advice appreciated.

Change History (2)

by Shaheed Haque, 18 months ago

Attachment: stack.png added

stack frames

comment:1 by Shaheed Haque, 18 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top