mirror of https://github.com/django/django.git
Fixed #28064 -- Removed double-quoting of key names in MultiValueDictKeyError.
This commit is contained in:
parent
7060f777b0
commit
14671affc3
|
@ -76,7 +76,7 @@ class MultiValueDict(dict):
|
||||||
try:
|
try:
|
||||||
list_ = super().__getitem__(key)
|
list_ = super().__getitem__(key)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise MultiValueDictKeyError(repr(key))
|
raise MultiValueDictKeyError(key)
|
||||||
try:
|
try:
|
||||||
return list_[-1]
|
return list_[-1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
|
|
@ -48,8 +48,9 @@ class MultiValueDictTests(SimpleTestCase):
|
||||||
[('name', ['Adrian', 'Simon']), ('position', ['Developer'])]
|
[('name', ['Adrian', 'Simon']), ('position', ['Developer'])]
|
||||||
)
|
)
|
||||||
|
|
||||||
with self.assertRaisesMessage(MultiValueDictKeyError, 'lastname'):
|
with self.assertRaises(MultiValueDictKeyError) as cm:
|
||||||
d.__getitem__('lastname')
|
d.__getitem__('lastname')
|
||||||
|
self.assertEqual(str(cm.exception), "'lastname'")
|
||||||
|
|
||||||
self.assertIsNone(d.get('lastname'))
|
self.assertIsNone(d.get('lastname'))
|
||||||
self.assertEqual(d.get('lastname', 'nonexistent'), 'nonexistent')
|
self.assertEqual(d.get('lastname', 'nonexistent'), 'nonexistent')
|
||||||
|
|
Loading…
Reference in New Issue