Author: jezdez
Date: 2011-06-26 09:52:21 -0700 (Sun, 26 Jun 2011)
New Revision: 16461
Modified:
django/trunk/django/forms/util.py
django/trunk/tests/regressiontests/forms/tests/util.py
Log:
Fixed #16230 -- Correctly escape errors message passed to ErrorDict. Thanks,
Gregor M?\195?\188llegger.
Modified: django/trunk/django/forms/util.py
===================================================================
--- django/trunk/django/forms/util.py 2011-06-26 16:52:13 UTC (rev 16460)
+++ django/trunk/django/forms/util.py 2011-06-26 16:52:21 UTC (rev 16461)
@@ -27,7 +27,7 @@
def as_ul(self):
if not self: return u''
return mark_safe(u'<ul class="errorlist">%s</ul>'
- % ''.join([u'<li>%s%s</li>' % (k, force_unicode(v))
+ % ''.join([u'<li>%s%s</li>' % (k,
conditional_escape(force_unicode(v)))
for k, v in self.items()]))
def as_text(self):
Modified: django/trunk/tests/regressiontests/forms/tests/util.py
===================================================================
--- django/trunk/tests/regressiontests/forms/tests/util.py 2011-06-26
16:52:13 UTC (rev 16460)
+++ django/trunk/tests/regressiontests/forms/tests/util.py 2011-06-26
16:52:21 UTC (rev 16461)
@@ -55,3 +55,7 @@
'<ul class="errorlist"><li>Example of link: <a
href="http://www.example.com/">example</a></li></ul>')
self.assertEqual(str(ErrorList([mark_safe(example)])),
'<ul class="errorlist"><li>Example of link: <a
href="http://www.example.com/">example</a></li></ul>')
+ self.assertEqual(str(ErrorDict({'name': example})),
+ '<ul class="errorlist"><li>nameExample of link: <a
href="http://www.example.com/">example</a></li></ul>')
+ self.assertEqual(str(ErrorDict({'name': mark_safe(example)})),
+ '<ul class="errorlist"><li>nameExample of link: <a
href="http://www.example.com/">example</a></li></ul>')
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.