1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #6160, #9111 -- Consistently apply conditional_escape to form errors and labels when outputing them as HTML.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9365 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey
2008-11-06 19:49:24 +00:00
parent 04354e1afc
commit bcd63cbfb0
5 changed files with 28 additions and 13 deletions

View File

@@ -49,4 +49,11 @@ u''
# Can take a non-string.
>>> print ValidationError(VeryBadError()).messages
<ul class="errorlist"><li>A very bad error.</li></ul>
# Escapes non-safe input but not input marked safe.
>>> example = 'Example of link: <a href="http://www.example.com/">example</a>'
>>> print ValidationError(example).messages
<ul class="errorlist"><li>Example of link: &lt;a href=&quot;http://www.example.com/&quot;&gt;example&lt;/a&gt;</li></ul>
>>> print ValidationError(mark_safe(example)).messages
<ul class="errorlist"><li>Example of link: <a href="http://www.example.com/">example</a></li></ul>
"""