From 893198509e3b821a56a56e4326929e0613aad983 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 16 Sep 2013 16:20:29 -0400 Subject: [PATCH] Fixed #15625 -- Made message in MultiValueDictKeyError less verbose. Thanks margieroginski for the suggestion. --- 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 f4f694f399f..2f60c29cb02 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -307,7 +307,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 263a5d4be7f..5887cad085c 100644 --- a/tests/utils_tests/test_datastructures.py +++ b/tests/utils_tests/test_datastructures.py @@ -221,11 +221,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