Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
379ad8a8
Commit
379ad8a8
authored
Jun 27, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pending deprecations -> deprecated
parent
3fcc0127
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
42 deletions
+42
-42
rest_framework/generics.py
+16
-16
rest_framework/mixins.py
+4
-4
rest_framework/relations.py
+18
-18
rest_framework/serializers.py
+4
-4
No files found.
rest_framework/generics.py
View file @
379ad8a8
...
...
@@ -108,11 +108,11 @@ class GenericAPIView(views.APIView):
deprecated_style
=
False
if
page_size
is
not
None
:
warnings
.
warn
(
'The `page_size` parameter to `paginate_queryset()` '
'is d
ue to be d
eprecated. '
'is deprecated. '
'Note that the return style of this method is also '
'changed, and will simply return a page object '
'when called without a `page_size` argument.'
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
DeprecationWarning
,
stacklevel
=
2
)
deprecated_style
=
True
else
:
# Determine the required page size.
...
...
@@ -123,10 +123,10 @@ class GenericAPIView(views.APIView):
if
not
self
.
allow_empty
:
warnings
.
warn
(
'The `allow_empty` parameter is d
ue to be d
eprecated. '
'The `allow_empty` parameter is deprecated. '
'To use `allow_empty=False` style behavior, You should override '
'`get_queryset()` and explicitly raise a 404 on empty querysets.'
,
Pending
DeprecationWarning
,
stacklevel
=
2
DeprecationWarning
,
stacklevel
=
2
)
paginator
=
self
.
paginator_class
(
queryset
,
page_size
,
...
...
@@ -166,10 +166,10 @@ class GenericAPIView(views.APIView):
if
not
filter_backends
and
self
.
filter_backend
:
warnings
.
warn
(
'The `filter_backend` attribute and `FILTER_BACKEND` setting '
'are d
ue to be d
eprecated in favor of a `filter_backends` '
'are deprecated in favor of a `filter_backends` '
'attribute and `DEFAULT_FILTER_BACKENDS` setting, that take '
'a *list* of filter backend classes.'
,
Pending
DeprecationWarning
,
stacklevel
=
2
DeprecationWarning
,
stacklevel
=
2
)
filter_backends
=
[
self
.
filter_backend
]
...
...
@@ -192,8 +192,8 @@ class GenericAPIView(views.APIView):
"""
if
queryset
is
not
None
:
warnings
.
warn
(
'The `queryset` parameter to `get_paginate_by()` '
'is d
ue to be d
eprecated.'
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
'is deprecated.'
,
DeprecationWarning
,
stacklevel
=
2
)
if
self
.
paginate_by_param
:
query_params
=
self
.
request
.
QUERY_PARAMS
...
...
@@ -272,16 +272,16 @@ class GenericAPIView(views.APIView):
filter_kwargs
=
{
self
.
lookup_field
:
lookup
}
elif
pk
is
not
None
and
self
.
lookup_field
==
'pk'
:
warnings
.
warn
(
'The `pk_url_kwarg` attribute is d
ue to be d
eprecated. '
'The `pk_url_kwarg` attribute is deprecated. '
'Use the `lookup_field` attribute instead'
,
Pending
DeprecationWarning
DeprecationWarning
)
filter_kwargs
=
{
'pk'
:
pk
}
elif
slug
is
not
None
and
self
.
lookup_field
==
'pk'
:
warnings
.
warn
(
'The `slug_url_kwarg` attribute is d
ue to be d
eprecated. '
'The `slug_url_kwarg` attribute is deprecated. '
'Use the `lookup_field` attribute instead'
,
Pending
DeprecationWarning
DeprecationWarning
)
filter_kwargs
=
{
self
.
slug_field
:
slug
}
else
:
...
...
@@ -482,9 +482,9 @@ class RetrieveUpdateDestroyAPIView(mixins.RetrieveModelMixin,
class
MultipleObjectAPIView
(
GenericAPIView
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
warnings
.
warn
(
'Subclassing `MultipleObjectAPIView` is d
ue to be d
eprecated. '
'Subclassing `MultipleObjectAPIView` is deprecated. '
'You should simply subclass `GenericAPIView` instead.'
,
Pending
DeprecationWarning
,
stacklevel
=
2
DeprecationWarning
,
stacklevel
=
2
)
super
(
MultipleObjectAPIView
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -492,8 +492,8 @@ class MultipleObjectAPIView(GenericAPIView):
class
SingleObjectAPIView
(
GenericAPIView
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
warnings
.
warn
(
'Subclassing `SingleObjectAPIView` is d
ue to be d
eprecated. '
'Subclassing `SingleObjectAPIView` is deprecated. '
'You should simply subclass `GenericAPIView` instead.'
,
Pending
DeprecationWarning
,
stacklevel
=
2
DeprecationWarning
,
stacklevel
=
2
)
super
(
SingleObjectAPIView
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
rest_framework/mixins.py
View file @
379ad8a8
...
...
@@ -24,14 +24,14 @@ def _get_validation_exclusions(obj, pk=None, slug_field=None, lookup_field=None)
include
=
[]
if
pk
:
#
Pending deprecation
#
Deprecated
pk_field
=
obj
.
_meta
.
pk
while
pk_field
.
rel
:
pk_field
=
pk_field
.
rel
.
to
.
_meta
.
pk
include
.
append
(
pk_field
.
name
)
if
slug_field
:
#
Pending deprecation
#
Deprecated
include
.
append
(
slug_field
)
if
lookup_field
and
lookup_field
!=
'pk'
:
...
...
@@ -77,10 +77,10 @@ class ListModelMixin(object):
# `.allow_empty = False`, to raise 404 errors on empty querysets.
if
not
self
.
allow_empty
and
not
self
.
object_list
:
warnings
.
warn
(
'The `allow_empty` parameter is d
ue to be d
eprecated. '
'The `allow_empty` parameter is deprecated. '
'To use `allow_empty=False` style behavior, You should override '
'`get_queryset()` and explicitly raise a 404 on empty querysets.'
,
Pending
DeprecationWarning
DeprecationWarning
)
class_name
=
self
.
__class__
.
__name__
error_msg
=
self
.
empty_error
%
{
'class_name'
:
class_name
}
...
...
rest_framework/relations.py
View file @
379ad8a8
...
...
@@ -314,7 +314,7 @@ class HyperlinkedRelatedField(RelatedField):
'incorrect_type'
:
_
(
'Incorrect type. Expected url string, received
%
s.'
),
}
# These are all
pending deprecation
# These are all
deprecated
pk_url_kwarg
=
'pk'
slug_field
=
'slug'
slug_url_kwarg
=
None
# Defaults to same as `slug_field` unless overridden
...
...
@@ -328,16 +328,16 @@ class HyperlinkedRelatedField(RelatedField):
self
.
lookup_field
=
kwargs
.
pop
(
'lookup_field'
,
self
.
lookup_field
)
self
.
format
=
kwargs
.
pop
(
'format'
,
None
)
# These are
pending deprecation
# These are
deprecated
if
'pk_url_kwarg'
in
kwargs
:
msg
=
'pk_url_kwarg is
pending deprecation
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
msg
=
'pk_url_kwarg is
deprecated
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
if
'slug_url_kwarg'
in
kwargs
:
msg
=
'slug_url_kwarg is
pending deprecation
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
msg
=
'slug_url_kwarg is
deprecated
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
if
'slug_field'
in
kwargs
:
msg
=
'slug_field is
pending deprecation
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
msg
=
'slug_field is
deprecated
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
self
.
pk_url_kwarg
=
kwargs
.
pop
(
'pk_url_kwarg'
,
self
.
pk_url_kwarg
)
self
.
slug_field
=
kwargs
.
pop
(
'slug_field'
,
self
.
slug_field
)
...
...
@@ -380,9 +380,9 @@ class HyperlinkedRelatedField(RelatedField):
# If the lookup succeeds using the default slug params,
# then `slug_field` is being used implicitly, and we
# we need to warn about the pending deprecation.
msg
=
'Implicit slug field hyperlinked fields are
pending deprecation
.'
\
msg
=
'Implicit slug field hyperlinked fields are
deprecated
.'
\
'You should set `lookup_field=slug` on the HyperlinkedRelatedField.'
warnings
.
warn
(
msg
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
return
ret
except
NoReverseMatch
:
pass
...
...
@@ -480,7 +480,7 @@ class HyperlinkedIdentityField(Field):
lookup_field
=
'pk'
read_only
=
True
# These are all
pending deprecation
# These are all
deprecated
pk_url_kwarg
=
'pk'
slug_field
=
'slug'
slug_url_kwarg
=
None
# Defaults to same as `slug_field` unless overridden
...
...
@@ -496,16 +496,16 @@ class HyperlinkedIdentityField(Field):
lookup_field
=
kwargs
.
pop
(
'lookup_field'
,
None
)
self
.
lookup_field
=
lookup_field
or
self
.
lookup_field
# These are
pending deprecation
# These are
deprecated
if
'pk_url_kwarg'
in
kwargs
:
msg
=
'pk_url_kwarg is
pending deprecation
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
msg
=
'pk_url_kwarg is
deprecated
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
if
'slug_url_kwarg'
in
kwargs
:
msg
=
'slug_url_kwarg is
pending deprecation
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
msg
=
'slug_url_kwarg is
deprecated
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
if
'slug_field'
in
kwargs
:
msg
=
'slug_field is
pending deprecation
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
msg
=
'slug_field is
deprecated
. Use lookup_field instead.'
warnings
.
warn
(
msg
,
DeprecationWarning
,
stacklevel
=
2
)
self
.
slug_field
=
kwargs
.
pop
(
'slug_field'
,
self
.
slug_field
)
default_slug_kwarg
=
self
.
slug_url_kwarg
or
self
.
slug_field
...
...
rest_framework/serializers.py
View file @
379ad8a8
...
...
@@ -593,10 +593,10 @@ class ModelSerializer(Serializer):
if
len
(
inspect
.
getargspec
(
self
.
get_nested_field
)
.
args
)
==
2
:
warnings
.
warn
(
'The `get_nested_field(model_field)` call signature '
'is d
ue to be d
eprecated. '
'is deprecated. '
'Use `get_nested_field(model_field, related_model, '
'to_many) instead'
,
Pending
DeprecationWarning
DeprecationWarning
)
field
=
self
.
get_nested_field
(
model_field
)
else
:
...
...
@@ -605,10 +605,10 @@ class ModelSerializer(Serializer):
if
len
(
inspect
.
getargspec
(
self
.
get_nested_field
)
.
args
)
==
3
:
warnings
.
warn
(
'The `get_related_field(model_field, to_many)` call '
'signature is d
ue to be d
eprecated. '
'signature is deprecated. '
'Use `get_related_field(model_field, related_model, '
'to_many) instead'
,
Pending
DeprecationWarning
DeprecationWarning
)
field
=
self
.
get_related_field
(
model_field
,
to_many
=
to_many
)
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment