From b9eb94e789c6f31047c6fa6b89654d0657605470 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 26 Jun 2011 16:52:21 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20#16230=20--=20Correctly=20escape=20erro?= =?UTF-8?q?rs=20message=20passed=20to=20ErrorDict.=20Thanks,=20Gregor=20M?= =?UTF-8?q?=C3=BCllegger.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.djangoproject.com/svn/django/trunk@16461 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/forms/util.py | 2 +- tests/regressiontests/forms/tests/util.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/django/forms/util.py b/django/forms/util.py index 1a1d823495..85baffa005 100644 --- a/django/forms/util.py +++ b/django/forms/util.py @@ -27,7 +27,7 @@ class ErrorDict(dict, StrAndUnicode): def as_ul(self): if not self: return u'' return mark_safe(u'' - % ''.join([u'
  • %s%s
  • ' % (k, force_unicode(v)) + % ''.join([u'
  • %s%s
  • ' % (k, conditional_escape(force_unicode(v))) for k, v in self.items()])) def as_text(self): diff --git a/tests/regressiontests/forms/tests/util.py b/tests/regressiontests/forms/tests/util.py index 81fec1cf91..bb6ffd8095 100644 --- a/tests/regressiontests/forms/tests/util.py +++ b/tests/regressiontests/forms/tests/util.py @@ -55,3 +55,7 @@ class FormsUtilTestCase(TestCase): '') self.assertEqual(str(ErrorList([mark_safe(example)])), '') + self.assertEqual(str(ErrorDict({'name': example})), + '') + self.assertEqual(str(ErrorDict({'name': mark_safe(example)})), + '')