diff options
| author | petedmarsh <petedmarsh@users.noreply.github.com> | 2017-04-11 17:44:52 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-04-11 12:44:52 -0400 |
| commit | 14671affc346e70f6bb24117fd4e6af72895864b (patch) | |
| tree | 9266eda3bc1c7daf67d1261e6e5893e3c9b118e4 | |
| parent | 7060f777b09da2a844820a39f227a420c2c6ff90 (diff) | |
Fixed #28064 -- Removed double-quoting of key names in MultiValueDictKeyError.
| -rw-r--r-- | django/utils/datastructures.py | 2 | ||||
| -rw-r--r-- | tests/utils_tests/test_datastructures.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index aba5bcf1c2..a21de8a74a 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -76,7 +76,7 @@ class MultiValueDict(dict): try: list_ = super().__getitem__(key) except KeyError: - raise MultiValueDictKeyError(repr(key)) + raise MultiValueDictKeyError(key) try: return list_[-1] except IndexError: diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py index df7020eac5..e66210759a 100644 --- a/tests/utils_tests/test_datastructures.py +++ b/tests/utils_tests/test_datastructures.py @@ -48,8 +48,9 @@ class MultiValueDictTests(SimpleTestCase): [('name', ['Adrian', 'Simon']), ('position', ['Developer'])] ) - with self.assertRaisesMessage(MultiValueDictKeyError, 'lastname'): + with self.assertRaises(MultiValueDictKeyError) as cm: d.__getitem__('lastname') + self.assertEqual(str(cm.exception), "'lastname'") self.assertIsNone(d.get('lastname')) self.assertEqual(d.get('lastname', 'nonexistent'), 'nonexistent') |
