Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.6.x] Fixed #15625 -- Made message in MultiValueDictKeyError less v…

…erbose.

Thanks margieroginski for the suggestion.

Backport of 8931985 from master
  • Loading branch information...
commit 275497c5709792b47c71538a7e58bb40e8d8d3a9 1 parent 325b03e
@timgraham timgraham authored
View
2  django/utils/datastructures.py
@@ -298,7 +298,7 @@ def __getitem__(self, key):
try:
list_ = super(MultiValueDict, self).__getitem__(key)
except KeyError:
- raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
+ raise MultiValueDictKeyError(repr(key))
try:
return list_[-1]
except IndexError:
View
6 tests/utils_tests/test_datastructures.py
@@ -234,11 +234,7 @@ def test_multivaluedict(self):
[('name', ['Adrian', 'Simon']),
('position', ['Developer'])])
- # MultiValueDictKeyError: "Key 'lastname' not found in
- # <MultiValueDict: {'position': ['Developer'],
- # 'name': ['Adrian', 'Simon']}>"
- six.assertRaisesRegex(self, MultiValueDictKeyError,
- r'"Key \'lastname\' not found in <MultiValueDict',
+ six.assertRaisesRegex(self, MultiValueDictKeyError, 'lastname',
d.__getitem__, 'lastname')
self.assertEqual(d.get('lastname'), None)
Please sign in to comment.
Something went wrong with that request. Please try again.