summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-09-07 11:30:03 -0500
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-09-07 11:31:08 -0500
commit7bb627936034c1b9500a8d250cce75b30f980b23 (patch)
tree3dab91fd426daee691c87241d4f2d33c14fc231b
parentc54fa1a7bc365fec79d4971bf22d5ad2799fde67 (diff)
Fixed an encoding issue in the test client.
Fixed comment_tests.tests.test_comment_view.CommentViewTests.testCommentPostRedirectWithInvalidIntegerPK. Refs #20530.
-rw-r--r--django/test/client.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/test/client.py b/django/test/client.py
index fe7c3131cf..936a92e4cd 100644
--- a/django/test/client.py
+++ b/django/test/client.py
@@ -333,7 +333,11 @@ class RequestFactory(object):
r.update(extra)
# If QUERY_STRING is absent or empty, we want to extract it from the URL.
if not r.get('QUERY_STRING'):
- r['QUERY_STRING'] = force_str(parsed[4])
+ query_string = force_bytes(parsed[4])
+ # WSGI requires latin-1 encoded strings. See get_path_info().
+ if six.PY3:
+ query_string = query_string.decode('iso-8859-1')2053020530
+ r['QUERY_STRING'] = query_string
return self.request(**r)