Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #289 from mjtamlyn/slugify-real-function

Fixed bug in 212b982 -- Removed duplicate code in removetags
  • Loading branch information...
commit bf12c663d9c2e42d62baa9c7212a18ed2fdc1aa3 2 parents 5b09fc8 + e498481
Andrew Godwin authored August 18, 2012

Showing 1 changed file with 2 additions and 7 deletions. Show diff stats Hide diff stats

  1. 9  django/template/defaultfilters.py
9  django/template/defaultfilters.py
@@ -468,13 +468,8 @@ def safeseq(value):
468 468
 @stringfilter
469 469
 def removetags(value, tags):
470 470
     """Removes a space separated list of [X]HTML tags from the output."""
471  
-    tags = [re.escape(tag) for tag in tags.split()]
472  
-    tags_re = '(%s)' % '|'.join(tags)
473  
-    starttag_re = re.compile(r'<%s(/?>|(\s+[^>]*>))' % tags_re, re.U)
474  
-    endtag_re = re.compile('</%s>' % tags_re)
475  
-    value = starttag_re.sub('', value)
476  
-    value = endtag_re.sub('', value)
477  
-    return value
  471
+    from django.utils.html import remove_tags
  472
+    return remove_tags(value, tags)
478 473
 
479 474
 @register.filter(is_safe=True)
480 475
 @stringfilter

0 notes on commit bf12c66

Please sign in to comment.
Something went wrong with that request. Please try again.