Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #16230 -- Correctly escape errors message passed to ErrorDict. …

…Thanks, Gregor Müllegger.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16461 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b9eb94e789c6f31047c6fa6b89654d0657605470 1 parent b4bd6bb
Jannis Leidel authored June 26, 2011
2  django/forms/util.py
@@ -27,7 +27,7 @@ def __unicode__(self):
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):
4  tests/regressiontests/forms/tests/util.py
@@ -55,3 +55,7 @@ def __unicode__(self): return u"A very bad error."
55 55
                          '<ul class="errorlist"><li>Example of link: &lt;a href=&quot;http://www.example.com/&quot;&gt;example&lt;/a&gt;</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: &lt;a href=&quot;http://www.example.com/&quot;&gt;example&lt;/a&gt;</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>')

0 notes on commit b9eb94e

Please sign in to comment.
Something went wrong with that request. Please try again.