summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-02-06 21:16:15 +0100
committerClaude Paroz <claude@2xlibre.net>2013-02-06 21:19:41 +0100
commit20ac33100cd20c17d1ceab075d96698974cc4778 (patch)
tree81c2b4efa5d173912198f9686c9628958fe5a298
parent3b952123ac29f66371f5c51a00026faf7cb945c1 (diff)
Partially revert 9efe1a721, strip_tags improvements
The new regex seems not stable enough for being released. Stripping with regex might need reevaluation for the next release. Refs #19237.
-rw-r--r--django/utils/html.py2
-rw-r--r--tests/regressiontests/utils/html.py1
2 files changed, 1 insertions, 2 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index b403e2f0cb..32a3b0757d 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -33,7 +33,7 @@ link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+')
html_gunk_re = re.compile(r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
hard_coded_bullets_re = re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join([re.escape(x) for x in DOTS]), re.DOTALL)
trailing_empty_content_re = re.compile(r'(?:<p>(?:&nbsp;|\s|<br \/>)*?</p>\s*)+\Z')
-strip_tags_re = re.compile(r'</?\S([^=]*=(\s*"[^"]*"|\s*\'[^\']*\'|\S*)|[^>])*?>', re.IGNORECASE)
+strip_tags_re = re.compile(r'<[^>]*?>', re.IGNORECASE)
def escape(text):
diff --git a/tests/regressiontests/utils/html.py b/tests/regressiontests/utils/html.py
index a0226c4765..cb8c217bfe 100644
--- a/tests/regressiontests/utils/html.py
+++ b/tests/regressiontests/utils/html.py
@@ -65,7 +65,6 @@ class TestUtilsHtml(unittest.TestCase):
('<f', '<f'),
('</fe', '</fe'),
('<x>b<y>', 'b'),
- ('a<p onclick="alert(\'<test>\')">b</p>c', 'abc'),
('a<p a >b</p>c', 'abc'),
('d<a:b c:d>e</p>f', 'def'),
)