1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #27583 -- Fixed MultiValueDict.getlist() crash when values for key is None.

Restored the behavior before 727d7ce6cb.
This commit is contained in:
Mariusz Felisiak 2016-12-09 21:31:52 +01:00 committed by Tim Graham
parent 4de8aaf7ff
commit 8e3a72f4fb
2 changed files with 6 additions and 1 deletions

View File

@ -146,7 +146,7 @@ class MultiValueDict(dict):
return default
else:
if force_list:
values = list(values)
values = list(values) if values is not None else None
return values
def getlist(self, key, default=None):

View File

@ -119,6 +119,11 @@ class MultiValueDictTests(SimpleTestCase):
values = x.getlist('b', default=MISSING)
self.assertIs(values, MISSING)
def test_getlist_none_empty_values(self):
x = MultiValueDict({'a': None, 'b': []})
self.assertIsNone(x.getlist('a'))
self.assertEqual(x.getlist('b'), [])
class ImmutableListTests(SimpleTestCase):