mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-31 18:40:07 +03:00
Merge branch 'py2drop' of https://github.com/auvipy/django-rest-framework into py2
This commit is contained in:
commit
0aa2958ea0
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Provides various authentication policies.
|
Provides various authentication policies.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ The `compat` module provides support for backwards compatibility with older
|
||||||
versions of Django/Python, and compatibility wrappers around optional packages.
|
versions of Django/Python, and compatibility wrappers around optional packages.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
|
@ -6,7 +6,6 @@ There are also various decorators for setting the API policies on function
|
||||||
based views, as well as the `@detail_route` and `@list_route` decorators, which are
|
based views, as well as the `@detail_route` and `@list_route` decorators, which are
|
||||||
used to annotate methods on viewsets that should be included by routers.
|
used to annotate methods on viewsets that should be included by routers.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import types
|
import types
|
||||||
import warnings
|
import warnings
|
||||||
|
|
|
@ -4,7 +4,6 @@ Handled exceptions raised by REST framework.
|
||||||
In addition Django's built in 403 and 404 exceptions are handled.
|
In addition Django's built in 403 and 404 exceptions are handled.
|
||||||
(`django.http.Http404` and `django.core.exceptions.PermissionDenied`)
|
(`django.http.Http404` and `django.core.exceptions.PermissionDenied`)
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
Provides generic filtering backends that can be used to filter the results
|
Provides generic filtering backends that can be used to filter the results
|
||||||
returned by list views.
|
returned by list views.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import operator
|
import operator
|
||||||
import warnings
|
import warnings
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Generic views that provide commonly needed behaviour.
|
Generic views that provide commonly needed behaviour.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
|
|
@ -6,7 +6,6 @@ some fairly ad-hoc information about the view.
|
||||||
Future implementations might use JSON schema or other definitions in order
|
Future implementations might use JSON schema or other definitions in order
|
||||||
to return this information in a more standardized way.
|
to return this information in a more standardized way.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Basic building blocks for generic class based views.
|
||||||
We don't bind behaviour to http method handlers yet,
|
We don't bind behaviour to http method handlers yet,
|
||||||
which allows mixin classes to be composed in interesting ways.
|
which allows mixin classes to be composed in interesting ways.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
Content negotiation deals with selecting an appropriate renderer given the
|
Content negotiation deals with selecting an appropriate renderer given the
|
||||||
incoming request. Typically this will be based on the request's Accept header.
|
incoming request. Typically this will be based on the request's Accept header.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
Pagination serializers determine the structure of the output that should
|
Pagination serializers determine the structure of the output that should
|
||||||
be used for paginated responses.
|
be used for paginated responses.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from base64 import b64decode, b64encode
|
from base64 import b64decode, b64encode
|
||||||
from collections import OrderedDict, namedtuple
|
from collections import OrderedDict, namedtuple
|
||||||
|
|
|
@ -4,7 +4,6 @@ Parsers are used to parse the content of incoming HTTP requests.
|
||||||
They give us a generic way of being able to handle various media types
|
They give us a generic way of being able to handle various media types
|
||||||
on the request, such as form content or json encoded data.
|
on the request, such as form content or json encoded data.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Provides a set of pluggable permission policies.
|
Provides a set of pluggable permission policies.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# coding: utf-8
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ on the response, such as JSON encoded data or HTML output.
|
||||||
|
|
||||||
REST framework also provides an HTML renderer that renders the browsable API.
|
REST framework also provides an HTML renderer that renders the browsable API.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
|
@ -8,7 +8,6 @@ The wrapped request then offers a richer API, in particular :
|
||||||
- full support of PUT method, including support for file uploads
|
- full support of PUT method, including support for file uploads
|
||||||
- form overloading of HTTP method, content type and content
|
- form overloading of HTTP method, content type and content
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -4,7 +4,6 @@ it is initialized with unrendered data, instead of a pre-rendered string.
|
||||||
|
|
||||||
The appropriate renderer is called during Django's template response rendering.
|
The appropriate renderer is called during Django's template response rendering.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.template.response import SimpleTemplateResponse
|
from django.template.response import SimpleTemplateResponse
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Provide urlresolver functions that return fully qualified URLs or view names
|
Provide urlresolver functions that return fully qualified URLs or view names
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.urls import NoReverseMatch
|
from django.urls import NoReverseMatch
|
||||||
from django.urls import reverse as django_reverse
|
from django.urls import reverse as django_reverse
|
||||||
|
|
|
@ -13,7 +13,6 @@ For example, you might have a `urls.py` that looks something like this:
|
||||||
|
|
||||||
urlpatterns = router.urls
|
urlpatterns = router.urls
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import warnings
|
import warnings
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
inspectors.py # Per-endpoint view introspection
|
inspectors.py # Per-endpoint view introspection
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ python primitives.
|
||||||
2. The process of marshalling between python primitives and request and
|
2. The process of marshalling between python primitives and request and
|
||||||
response content is handled by parsers and renderers.
|
response content is handled by parsers and renderers.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import inspect
|
import inspect
|
||||||
|
|
|
@ -18,7 +18,6 @@ This module provides the `api_setting` object, that is used to access
|
||||||
REST framework settings, checking for user settings first, then falling
|
REST framework settings, checking for user settings first, then falling
|
||||||
back to the defaults.
|
back to the defaults.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ See RFC 2616 - https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
||||||
And RFC 6585 - https://tools.ietf.org/html/rfc6585
|
And RFC 6585 - https://tools.ietf.org/html/rfc6585
|
||||||
And RFC 4918 - https://tools.ietf.org/html/rfc4918
|
And RFC 4918 - https://tools.ietf.org/html/rfc4918
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
|
|
||||||
def is_informational(code):
|
def is_informational(code):
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# -- coding: utf-8 --
|
|
||||||
|
|
||||||
# Note that we import as `DjangoRequestFactory` and `DjangoClient` in order
|
# Note that we import as `DjangoRequestFactory` and `DjangoClient` in order
|
||||||
# to make it harder for the user to import the wrong thing without realizing.
|
# to make it harder for the user to import the wrong thing without realizing.
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import io
|
import io
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Provides various throttling policies.
|
Provides various throttling policies.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url
|
||||||
|
|
||||||
from rest_framework.compat import (
|
from rest_framework.compat import (
|
||||||
|
|
|
@ -11,7 +11,6 @@ your API requires authentication:
|
||||||
|
|
||||||
You should make sure your authentication settings include `SessionAuthentication`.
|
You should make sure your authentication settings include `SessionAuthentication`.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth import views
|
from django.contrib.auth import views
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.urls import get_script_prefix, resolve
|
from django.urls import get_script_prefix, resolve
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Helper classes for parsers.
|
Helper classes for parsers.
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
import json # noqa
|
import json # noqa
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Utility functions to return a formatted name and description for a given view.
|
Utility functions to return a formatted name and description for a given view.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ spec-compliant encoding/decoding. Support for non-standard features should be
|
||||||
handled by users at the renderer and parser layer.
|
handled by users at the renderer and parser layer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import json # noqa
|
import json # noqa
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ Handling of media types, as found in HTTP Content-Type and Accept headers.
|
||||||
|
|
||||||
See https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
|
See https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.http.multipartparser import parse_header
|
from django.http.multipartparser import parse_header
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
Helper functions for creating user-friendly representations
|
Helper functions for creating user-friendly representations
|
||||||
of serializer classes and serializer fields.
|
of serializer classes and serializer fields.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ This gives us better separation of concerns, allows us to use single-step
|
||||||
object creation, and makes it possible to switch between using the implicit
|
object creation, and makes it possible to switch between using the implicit
|
||||||
`ModelSerializer` class and an equivalent explicit `Serializer` class.
|
`ModelSerializer` class and an equivalent explicit `Serializer` class.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.db import DataError
|
from django.db import DataError
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# coding: utf-8
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Provides an APIView class that is the base of all views in REST framework.
|
Provides an APIView class that is the base of all views in REST framework.
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
|
|
|
@ -16,7 +16,6 @@ automatically.
|
||||||
router.register(r'users', UserViewSet, 'user')
|
router.register(r'users', UserViewSet, 'user')
|
||||||
urlpatterns = router.urls
|
urlpatterns = router.urls
|
||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from functools import update_wrapper
|
from functools import update_wrapper
|
||||||
|
|
Loading…
Reference in New Issue
Block a user