Stop calling set_context
, planned for 3.13 drop by DavidCain · Pull Request #8589 · encode/django-rest-framework (original) (raw)
Per the deprecation warnings (which have been raised since DRF 3.11),set_context()
was planned not to be supported in DRF 3.13. I think we
can safely delete it, in favor of requires_context
.
Since this represents an API change, maybe it's best slated for 3.14?
(We could alternatively start raising RemovedInDRF314Warning
)
From the 3.11 announcement:
Previous our approach to this was that implementations could include a
set_context
method, which would be called prior to validation. However
this approach had issues with potential race conditions. We have now
move this approach into a pending deprecation state. It will continue to
function, but will be escalated to a deprecated state in 3.12, and
removed entirely in 3.13.
Why keep RemovedInDRF313Warning
around?
It's a bit odd that version 3.13 includes an exception class describing
things which are to be deleted in 3.13, but I've opted to keep the (now
unreferenced) class around, for fear of breaking others' setup.
(For example, if projects have a filterwarnings
setup meant to
intercept rest_framework.RemovedInDRF313Warning
, an error will be
thrown due to an unresolvable reference).