Code

Ticket #17641: 17641-1.diff

File 17641-1.diff, 649 bytes (added by ramiro, 2 years ago)
Line 
1diff --git a/django/utils/htmlparser.py b/django/utils/htmlparser.py
2--- a/django/utils/htmlparser.py
3+++ b/django/utils/htmlparser.py
4@@ -1,4 +1,5 @@
5 import HTMLParser as _HTMLParser
6+import re
7 
8 
9 class HTMLParser(_HTMLParser.HTMLParser):
10@@ -11,7 +12,10 @@
11         self.cdata_tag = None
12 
13     def set_cdata_mode(self, tag):
14-        self.interesting = _HTMLParser.interesting_cdata
15+        try:
16+            self.interesting = _HTMLParser.interesting_cdata
17+        except AttributeError:
18+            self.interesting = re.compile(r'</\s*%s\s*>' % tag.lower(), re.I)
19         self.cdata_tag = tag.lower()
20 
21     def clear_cdata_mode(self):