Rely on built-in unquote functionality from Python

This commit is contained in:
Henrik Ossipoff Hansen 2014-05-19 14:54:00 +02:00
parent 6c0624631e
commit 73aa12297a
2 changed files with 5 additions and 2 deletions

View File

@ -3,13 +3,16 @@
# 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 from __future__ import unicode_literals
try:
from urllib import unquote
except ImportError:
from urllib.parse import unquote
import django import django
from django.conf import settings from django.conf import settings
from django.test.client import Client as DjangoClient from django.test.client import Client as DjangoClient
from django.test.client import ClientHandler from django.test.client import ClientHandler
from django.test import testcases from django.test import testcases
from django.utils.http import urlencode from django.utils.http import urlencode
from django.utils.six.moves.urllib.parse import unquote
from rest_framework.settings import api_settings from rest_framework.settings import api_settings
from rest_framework.compat import RequestFactory as DjangoRequestFactory from rest_framework.compat import RequestFactory as DjangoRequestFactory
from rest_framework.compat import force_bytes_or_smart_bytes, six from rest_framework.compat import force_bytes_or_smart_bytes, six

View File

@ -355,6 +355,6 @@ class TestQueryString(IETestCase):
urls = 'rest_framework.tests.test_request' urls = 'rest_framework.tests.test_request'
def test_query_string_utf8(self): def test_query_string_utf8(self):
qs = {'q': u'pølse'} qs = {'q': 'pølse'}
response = self.client.get('/', qs) response = self.client.get('/', qs)
self.assertEqual(status.HTTP_200_OK, response.status_code) self.assertEqual(status.HTTP_200_OK, response.status_code)