mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Merge pull request #5210 from blueyed/DeprecationWarning-stacklevel
Use stacklevel=2 with DeprecationWarnings
This commit is contained in:
commit
b96a22011b
|
@ -48,7 +48,7 @@ if django_filters:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The built in 'rest_framework.filters.FilterSet' is deprecated. "
|
"The built in 'rest_framework.filters.FilterSet' is deprecated. "
|
||||||
"You should use 'django_filters.rest_framework.FilterSet' instead.",
|
"You should use 'django_filters.rest_framework.FilterSet' instead.",
|
||||||
DeprecationWarning
|
DeprecationWarning, stacklevel=2
|
||||||
)
|
)
|
||||||
return super(FilterSet, self).__init__(*args, **kwargs)
|
return super(FilterSet, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class DjangoFilterBackend(DFBase):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"The built in 'rest_framework.filters.DjangoFilterBackend' is deprecated. "
|
"The built in 'rest_framework.filters.DjangoFilterBackend' is deprecated. "
|
||||||
"You should use 'django_filters.rest_framework.DjangoFilterBackend' instead.",
|
"You should use 'django_filters.rest_framework.DjangoFilterBackend' instead.",
|
||||||
DeprecationWarning
|
DeprecationWarning, stacklevel=2
|
||||||
)
|
)
|
||||||
|
|
||||||
return super(DjangoFilterBackend, cls).__new__(cls, *args, **kwargs)
|
return super(DjangoFilterBackend, cls).__new__(cls, *args, **kwargs)
|
||||||
|
|
|
@ -333,7 +333,7 @@ class DefaultRouter(SimpleRouter):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"Including a schema directly via a router is now deprecated. "
|
"Including a schema directly via a router is now deprecated. "
|
||||||
"Use `get_schema_view()` instead.",
|
"Use `get_schema_view()` instead.",
|
||||||
DeprecationWarning
|
DeprecationWarning, stacklevel=2
|
||||||
)
|
)
|
||||||
if 'schema_renderers' in kwargs:
|
if 'schema_renderers' in kwargs:
|
||||||
assert 'schema_title' in kwargs, 'Missing "schema_title" argument.'
|
assert 'schema_title' in kwargs, 'Missing "schema_title" argument.'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user