summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2012-02-05 10:29:08 +0000
committerJannis Leidel <jannis@leidel.info>2012-02-05 10:29:08 +0000
commit44d1791779ecf86ab5de92bce5236f9401efce0e (patch)
tree88b4e262fc7569b7f69b562302302678f8fe1747
parent0f6cf4aba1d3db4be9a0d593becfc10bc4aa1fbe (diff)
Fixed #17641 -- Work around an issue in Python distributions that remove the module attribute ('2.7.2+'). Many thanks to Ramiro Morales for finding it.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17456 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/utils/htmlparser.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/utils/htmlparser.py b/django/utils/htmlparser.py
index ed743f5679..b28005705e 100644
--- a/django/utils/htmlparser.py
+++ b/django/utils/htmlparser.py
@@ -1,4 +1,5 @@
import HTMLParser as _HTMLParser
+import re
class HTMLParser(_HTMLParser.HTMLParser):
@@ -11,7 +12,10 @@ class HTMLParser(_HTMLParser.HTMLParser):
self.cdata_tag = None
def set_cdata_mode(self, tag):
- self.interesting = _HTMLParser.interesting_cdata
+ try:
+ self.interesting = _HTMLParser.interesting_cdata
+ except AttributeError:
+ self.interesting = re.compile(r'</\s*%s\s*>' % tag.lower(), re.I)
self.cdata_tag = tag.lower()
def clear_cdata_mode(self):