Skip to content

Commit 77c896a

Browse files
committed
Updated list_route() and detail_route() deprecations.
1 parent 96d0fb4 commit 77c896a

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

rest_framework/decorators.py

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

227227
def decorator(func):
@@ -237,9 +237,9 @@ def list_route(methods=None, **kwargs):
237237
Used to mark a method on a ViewSet that should be routed for list requests.
238238
"""
239239
warnings.warn(
240-
"`list_route` is pending deprecation and will be removed in 3.10 in favor of "
240+
"`list_route` is deprecated and will be removed in 3.10 in favor of "
241241
"`action`, which accepts a `detail` bool. Use `@action(detail=False)` instead.",
242-
PendingDeprecationWarning, stacklevel=2
242+
DeprecationWarning, stacklevel=2
243243
)
244244

245245
def decorator(func):

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
@@ -250,34 +250,34 @@ def test_action():
250250
raise NotImplementedError
251251

252252
def test_detail_route_deprecation(self):
253-
with pytest.warns(PendingDeprecationWarning) as record:
253+
with pytest.warns(DeprecationWarning) as record:
254254
@detail_route()
255255
def view(request):
256256
raise NotImplementedError
257257

258258
assert len(record) == 1
259259
assert str(record[0].message) == (
260-
"`detail_route` is pending deprecation and will be removed in "
260+
"`detail_route` is deprecated and will be removed in "
261261
"3.10 in favor of `action`, which accepts a `detail` bool. Use "
262262
"`@action(detail=True)` instead."
263263
)
264264

265265
def test_list_route_deprecation(self):
266-
with pytest.warns(PendingDeprecationWarning) as record:
266+
with pytest.warns(DeprecationWarning) as record:
267267
@list_route()
268268
def view(request):
269269
raise NotImplementedError
270270

271271
assert len(record) == 1
272272
assert str(record[0].message) == (
273-
"`list_route` is pending deprecation and will be removed in "
273+
"`list_route` is deprecated and will be removed in "
274274
"3.10 in favor of `action`, which accepts a `detail` bool. Use "
275275
"`@action(detail=False)` instead."
276276
)
277277

278278
def test_route_url_name_from_path(self):
279279
# pre-3.8 behavior was to base the `url_name` off of the `url_path`
280-
with pytest.warns(PendingDeprecationWarning):
280+
with pytest.warns(DeprecationWarning):
281281
@list_route(url_path='foo_bar')
282282
def view(request):
283283
raise NotImplementedError

0 commit comments

Comments
 (0)