1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[2.1.x] Fixed #29627 -- Fixed QueryDict.urlencode() crash with non-string values.

Regression in 7d96f0c49a.
Backport of d8e2be459f from master
This commit is contained in:
Tim Graham
2018-08-02 21:56:26 -04:00
parent 66c0c58cf2
commit 0cfca0f2cc
3 changed files with 11 additions and 1 deletions

View File

@@ -114,6 +114,13 @@ class QueryDictTests(SimpleTestCase):
self.assertEqual(q.urlencode(), 'next=%2Ft%C3%ABst%26key%2F')
self.assertEqual(q.urlencode(safe='/'), 'next=/t%C3%ABst%26key/')
def test_urlencode_int(self):
# Normally QueryDict doesn't contain non-string values but lazily
# written tests may make that mistake.
q = QueryDict(mutable=True)
q['a'] = 1
self.assertEqual(q.urlencode(), 'a=1')
def test_mutable_copy(self):
"""A copy of a QueryDict is mutable."""
q = QueryDict().copy()