From 275497c5709792b47c71538a7e58bb40e8d8d3a9 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 16 Sep 2013 16:20:29 -0400 Subject: [PATCH] [1.6.x] Fixed #15625 -- Made message in MultiValueDictKeyError less verbose. Thanks margieroginski for the suggestion. Backport of 893198509e from master --- django/utils/datastructures.py | 2 +- tests/utils_tests/test_datastructures.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index a2113233207..f854933feaf 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -298,7 +298,7 @@ class MultiValueDict(dict): 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: diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py index 2692b85a7d5..f67fff0a4b9 100644 --- a/tests/utils_tests/test_datastructures.py +++ b/tests/utils_tests/test_datastructures.py @@ -234,11 +234,7 @@ class MultiValueDictTests(SimpleTestCase): [('name', ['Adrian', 'Simon']), ('position', ['Developer'])]) - # MultiValueDictKeyError: "Key 'lastname' not found in - # " - six.assertRaisesRegex(self, MultiValueDictKeyError, - r'"Key \'lastname\' not found in