diff --git a/django/forms/util.py b/django/forms/util.py
index 1a1d823..85baffa 100644
a
|
b
|
class ErrorDict(dict, StrAndUnicode):
|
27 | 27 | def as_ul(self): |
28 | 28 | if not self: return u'' |
29 | 29 | return mark_safe(u'<ul class="errorlist">%s</ul>' |
30 | | % ''.join([u'<li>%s%s</li>' % (k, force_unicode(v)) |
| 30 | % ''.join([u'<li>%s%s</li>' % (k, conditional_escape(force_unicode(v))) |
31 | 31 | for k, v in self.items()])) |
32 | 32 | |
33 | 33 | def as_text(self): |
diff --git a/tests/regressiontests/forms/tests/util.py b/tests/regressiontests/forms/tests/util.py
index 81fec1c..bb6ffd8 100644
a
|
b
|
class FormsUtilTestCase(TestCase):
|
55 | 55 | '<ul class="errorlist"><li>Example of link: <a href="http://www.example.com/">example</a></li></ul>') |
56 | 56 | self.assertEqual(str(ErrorList([mark_safe(example)])), |
57 | 57 | '<ul class="errorlist"><li>Example of link: <a href="http://www.example.com/">example</a></li></ul>') |
| 58 | self.assertEqual(str(ErrorDict({'name': example})), |
| 59 | '<ul class="errorlist"><li>nameExample of link: <a href="http://www.example.com/">example</a></li></ul>') |
| 60 | self.assertEqual(str(ErrorDict({'name': mark_safe(example)})), |
| 61 | '<ul class="errorlist"><li>nameExample of link: <a href="http://www.example.com/">example</a></li></ul>') |