mirror of https://github.com/django/django.git
Fixed #27583 -- Fixed MultiValueDict.getlist() crash when values for key is None.
Restored the behavior before 727d7ce6cb
.
This commit is contained in:
parent
4de8aaf7ff
commit
8e3a72f4fb
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
Loading…
Reference in New Issue