From e4984812cd54f7c5f27ccb754fc8ddadcb0693f9 Mon Sep 17 00:00:00 2001 From: Marc Tamlyn Date: Sat, 18 Aug 2012 17:06:45 +0100 Subject: [PATCH] Fixed bug in 212b982 -- Removed duplicate code in removetags --- django/template/defaultfilters.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index d8b0c3439a..1bfb627023 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -468,13 +468,8 @@ def safeseq(value): @stringfilter def removetags(value, tags): """Removes a space separated list of [X]HTML tags from the output.""" - 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) - value = starttag_re.sub('', value) - value = endtag_re.sub('', value) - return value + from django.utils.html import remove_tags + return remove_tags(value, tags) @register.filter(is_safe=True) @stringfilter