Skip to content

Commit cfd7382

Browse files
committed
Updated list_route() and detail_route() deprecations.
1 parent 7fb11bf commit cfd7382

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

rest_framework/decorators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ def detail_route(methods=None, **kwargs):
223223
Used to mark a method on a ViewSet that should be routed for detail requests.
224224
"""
225225
warnings.warn(
226-
"`detail_route` is pending deprecation and will be removed in 3.10 in favor of "
226+
"`detail_route` is deprecated and will be removed in 3.10 in favor of "
227227
"`action`, which accepts a `detail` bool. Use `@action(detail=True)` instead.",
228-
PendingDeprecationWarning, stacklevel=2
228+
DeprecationWarning, stacklevel=2
229229
)
230230

231231
def decorator(func):
@@ -241,9 +241,9 @@ def list_route(methods=None, **kwargs):
241241
Used to mark a method on a ViewSet that should be routed for list requests.
242242
"""
243243
warnings.warn(
244-
"`list_route` is pending deprecation and will be removed in 3.10 in favor of "
244+
"`list_route` is deprecated and will be removed in 3.10 in favor of "
245245
"`action`, which accepts a `detail` bool. Use `@action(detail=False)` instead.",
246-
PendingDeprecationWarning, stacklevel=2
246+
DeprecationWarning, stacklevel=2
247247
)
248248

249249
def decorator(func):

rest_framework/routers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@
4040
class DynamicDetailRoute(object):
4141
def __new__(cls, url, name, initkwargs):
4242
warnings.warn(
43-
"`DynamicDetailRoute` is pending deprecation and will be removed in 3.10 "
43+
"`DynamicDetailRoute` is deprecated and will be removed in 3.10 "
4444
"in favor of `DynamicRoute`, which accepts a `detail` boolean. Use "
4545
"`DynamicRoute(url, name, True, initkwargs)` instead.",
46-
PendingDeprecationWarning, stacklevel=2
46+
DeprecationWarning, stacklevel=2
4747
)
4848
return DynamicRoute(url, name, True, initkwargs)
4949

5050

5151
class DynamicListRoute(object):
5252
def __new__(cls, url, name, initkwargs):
5353
warnings.warn(
54-
"`DynamicListRoute` is pending deprecation and will be removed in 3.10 in "
54+
"`DynamicListRoute` is deprecated and will be removed in 3.10 in "
5555
"favor of `DynamicRoute`, which accepts a `detail` boolean. Use "
5656
"`DynamicRoute(url, name, False, initkwargs)` instead.",
57-
PendingDeprecationWarning, stacklevel=2
57+
DeprecationWarning, stacklevel=2
5858
)
5959
return DynamicRoute(url, name, False, initkwargs)
6060

rest_framework/schemas/generators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
See schemas.__init__.py for package overview.
55
"""
66
import re
7-
import warnings
87
from collections import Counter, OrderedDict
98
from importlib import import_module
109

tests/test_decorators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,34 +290,34 @@ def test_action():
290290
raise NotImplementedError
291291

292292
def test_detail_route_deprecation(self):
293-
with pytest.warns(PendingDeprecationWarning) as record:
293+
with pytest.warns(DeprecationWarning) as record:
294294
@detail_route()
295295
def view(request):
296296
raise NotImplementedError
297297

298298
assert len(record) == 1
299299
assert str(record[0].message) == (
300-
"`detail_route` is pending deprecation and will be removed in "
300+
"`detail_route` is deprecated and will be removed in "
301301
"3.10 in favor of `action`, which accepts a `detail` bool. Use "
302302
"`@action(detail=True)` instead."
303303
)
304304

305305
def test_list_route_deprecation(self):
306-
with pytest.warns(PendingDeprecationWarning) as record:
306+
with pytest.warns(DeprecationWarning) as record:
307307
@list_route()
308308
def view(request):
309309
raise NotImplementedError
310310

311311
assert len(record) == 1
312312
assert str(record[0].message) == (
313-
"`list_route` is pending deprecation and will be removed in "
313+
"`list_route` is deprecated and will be removed in "
314314
"3.10 in favor of `action`, which accepts a `detail` bool. Use "
315315
"`@action(detail=False)` instead."
316316
)
317317

318318
def test_route_url_name_from_path(self):
319319
# pre-3.8 behavior was to base the `url_name` off of the `url_path`
320-
with pytest.warns(PendingDeprecationWarning):
320+
with pytest.warns(DeprecationWarning):
321321
@list_route(url_path='foo_bar')
322322
def view(request):
323323
raise NotImplementedError

0 commit comments

Comments
 (0)