Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #15625 -- Made message in MultiValueDictKeyError less verbose.

Thanks margieroginski for the suggestion.
  • Loading branch information...
commit 893198509e3b821a56a56e4326929e0613aad983 1 parent 50633e7
Tim Graham timgraham authored
2  django/utils/datastructures.py
View
@@ -307,7 +307,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:
6 tests/utils_tests/test_datastructures.py
View
@@ -221,11 +221,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.