From 222d0633010e2f37f9fbd2d0559ecc4a5643c738 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 18 Aug 2015 10:09:17 -0400 Subject: Refs #23269 -- Removed the removetags template tag and related functions per deprecation timeline. --- django/utils/html.py | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'django/utils') 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('' % 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): -- cgit v1.3