Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

magic-removal: Fixed #1270 -- Made the escape filter escape single qu…

…otes

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2738 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 980a522f9f5ba4774ebeef3fffb8722c481f9da2 1 parent 213b6a6
@adrianholovaty adrianholovaty authored
Showing with 3 additions and 2 deletions.
  1. +1 −1  django/utils/html.py
  2. +2 −1  docs/templates.txt
View
2  django/utils/html.py
@@ -25,7 +25,7 @@ def escape(html):
"Returns the given HTML with ampersands, quotes and carets encoded"
if not isinstance(html, basestring):
html = str(html)
- return html.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;')
+ return html.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;').replace("'", '&#39;')
def linebreaks(value):
"Converts newlines into <p> and <br />s"
View
3  docs/templates.txt
@@ -844,7 +844,8 @@ Escapes a string's HTML. Specifically, it makes these replacements:
* ``"&"`` to ``"&amp;"``
* ``<`` to ``"&lt;"``
* ``>`` to ``"&gt;"``
- * ``'"'`` (double quote) to ``"&quot;"``
+ * ``'"'`` (double quote) to ``'&quot;'``
+ * ``"'"`` (single quote) to ``'&#39;'``
filesizeformat
~~~~~~~~~~~~~~
Please sign in to comment.
Something went wrong with that request. Please try again.