-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Drop set_context()
#7062
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
Drop set_context()
#7062
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of the two options you mentioned in #6172 (comment), I much prefer this. (To inspecting __call__()
)
Looks neat at first glance. Would need calling out in the release notes, but should be simple enough to inline existing set_context()
implementations.
Sure, also it is still our regular gentle deprecation process, so not a big deal. |
My brain is currently toast, but I'll try to look at this over the weekend. |
In encode/django-rest-framework#7062 the API for calling DRF validators changed to require the caller to inspect the validator instance to determine if the validator requires a second argument at call time. Usage with DRF >=3.11.0 requires this support.
In encode/django-rest-framework#7062 the API for calling DRF validators changed to require the caller to inspect the validator instance to determine if the validator requires a second argument at call time. Usage with DRF >=3.11.0 requires this support.
* Do not persist the context in validators Fixes encode#5760 * Drop set_context() in favour of 'requires_context = True'
* Do not persist the context in validators Fixes encode#5760 * Drop set_context() in favour of 'requires_context = True'
Follow on from #6172
Drops
set_context()
on defaults and validators, in favour of arequires_context = True
marker, which causes the serializer field to be passed as an additional argument.What do we think about this?