Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

Thanks margieroginski for the suggestion.
  • Loading branch information...
commit 893198509e3b821a56a56e4326929e0613aad983 1 parent 50633e7
Tim Graham authored September 16, 2013
2  django/utils/datastructures.py
@@ -307,7 +307,7 @@ def __getitem__(self, key):
307 307
         try:
308 308
             list_ = super(MultiValueDict, self).__getitem__(key)
309 309
         except KeyError:
310  
-            raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
  310
+            raise MultiValueDictKeyError(repr(key))
311 311
         try:
312 312
             return list_[-1]
313 313
         except IndexError:
6  tests/utils_tests/test_datastructures.py
@@ -221,11 +221,7 @@ def test_multivaluedict(self):
221 221
                           [('name', ['Adrian', 'Simon']),
222 222
                            ('position', ['Developer'])])
223 223
 
224  
-        # MultiValueDictKeyError: "Key 'lastname' not found in
225  
-        # <MultiValueDict: {'position': ['Developer'],
226  
-        #                   'name': ['Adrian', 'Simon']}>"
227  
-        six.assertRaisesRegex(self, MultiValueDictKeyError,
228  
-            r'"Key \'lastname\' not found in <MultiValueDict',
  224
+        six.assertRaisesRegex(self, MultiValueDictKeyError, 'lastname',
229 225
             d.__getitem__, 'lastname')
230 226
 
231 227
         self.assertEqual(d.get('lastname'), None)

0 notes on commit 8931985

Please sign in to comment.
Something went wrong with that request. Please try again.