summaryrefslogtreecommitdiff
path: root/django/utils/html.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-18 10:09:17 -0400
committerTim Graham <timograham@gmail.com>2015-09-23 19:31:09 -0400
commit222d0633010e2f37f9fbd2d0559ecc4a5643c738 (patch)
tree5f8fce14ce26c2ae0e3548c7a6c07cdc0389082b /django/utils/html.py
parent785cc71d5b3300e2702b0b2fc7316e58ca70b563 (diff)
Refs #23269 -- Removed the removetags template tag and related functions per deprecation timeline.
Diffstat (limited to 'django/utils/html.py')
-rw-r--r--django/utils/html.py29
1 files changed, 0 insertions, 29 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index 9387e712dc..1d86441a28 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -3,10 +3,8 @@
from __future__ import unicode_literals
import re
-import warnings
from django.utils import six
-from django.utils.deprecation import RemovedInDjango110Warning
from django.utils.encoding import force_str, force_text
from django.utils.functional import allow_lazy
from django.utils.http import RFC3986_GENDELIMS, RFC3986_SUBDELIMS
@@ -184,39 +182,12 @@ def strip_tags(value):
strip_tags = allow_lazy(strip_tags)
-def remove_tags(html, tags):
- """Returns the given HTML with given tags removed."""
- warnings.warn(
- "django.utils.html.remove_tags() and the removetags template filter "
- "are deprecated. Consider using the bleach library instead.",
- RemovedInDjango110Warning, stacklevel=3
- )
- tags = [re.escape(tag) for tag in tags.split()]
- tags_re = '(%s)' % '|'.join(tags)
- starttag_re = re.compile(r'<%s(/?>|(\s+[^>]*>))' % tags_re, re.U)
- endtag_re = re.compile('</%s>' % tags_re)
- html = starttag_re.sub('', html)
- html = endtag_re.sub('', html)
- return html
-remove_tags = allow_lazy(remove_tags, six.text_type)
-
-
def strip_spaces_between_tags(value):
"""Returns the given HTML with spaces between tags removed."""
return re.sub(r'>\s+<', '><', force_text(value))
strip_spaces_between_tags = allow_lazy(strip_spaces_between_tags, six.text_type)
-def strip_entities(value):
- """Returns the given HTML with all entities (&something;) stripped."""
- warnings.warn(
- "django.utils.html.strip_entities() is deprecated.",
- RemovedInDjango110Warning, stacklevel=2
- )
- return re.sub(r'&(?:\w+|#\d+);', '', force_text(value))
-strip_entities = allow_lazy(strip_entities, six.text_type)
-
-
def smart_urlquote(url):
"Quotes a URL if it isn't already quoted."
def unquote_quote(segment):