summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorErik Romijn <eromijn@solidlinks.nl>2014-03-01 10:42:08 +0100
committerErik Romijn <eromijn@solidlinks.nl>2014-03-01 14:07:57 +0100
commit775975f15d7d461c154e558cba5fb0592539126f (patch)
tree818be1016cf0527aa38888151778bfd59fcd9012 /django
parent8c98f39624a60c63a16e097b64e5f71ecc27271f (diff)
Fixed #22130 -- Deprecated fix_ampersands, removed utils.clean_html()
Diffstat (limited to 'django')
-rw-r--r--django/utils/html.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index b6b639d538..a08b62ff5e 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -3,6 +3,7 @@
from __future__ import unicode_literals
import re
+import warnings
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import force_text, force_str
@@ -174,6 +175,9 @@ strip_entities = allow_lazy(strip_entities, six.text_type)
def fix_ampersands(value):
"""Returns the given HTML with all unencoded ampersands encoded correctly."""
+ # As fix_ampersands is wrapped in allow_lazy, stacklevel 3 is more useful than 2.
+ warnings.warn("The fix_ampersands function is deprecated and will be removed in Django 1.8.",
+ DeprecationWarning, stacklevel=3)
return unencoded_ampersands_re.sub('&amp;', force_text(value))
fix_ampersands = allow_lazy(fix_ampersands, six.text_type)
@@ -290,6 +294,9 @@ def clean_html(text):
* Remove stuff like "<p>&nbsp;&nbsp;</p>", but only if it's at the
bottom of the text.
"""
+ # As clean_html is wrapped in allow_lazy, stacklevel 3 is more useful than 2.
+ warnings.warn("The clean_html function is deprecated and will be removed in Django 1.8.",
+ DeprecationWarning, stacklevel=3)
text = normalize_newlines(text)
text = re.sub(r'<(/?)\s*b\s*>', '<\\1strong>', text)
text = re.sub(r'<(/?)\s*i\s*>', '<\\1em>', text)