]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/utils/html.py
Applies some of the Justin Grant's patches.
[osqa.git] / forum / utils / html.py
index cab52a4252ecd666dc5c9e06958a5f0300cde9bc..6afaf62ac3978f62ad6933b2a29ceb3679ef50c9 100644 (file)
@@ -1,6 +1,6 @@
 """Utilities for working with HTML."""
-import html5lib
-from html5lib import sanitizer, serializer, tokenizer, treebuilders, treewalkers
+#import html5lib
+from html5lib import sanitizer, serializer, tokenizer, treebuilders, treewalkers, HTMLParser
 from django.utils.html import strip_tags
 from forum.utils.html2text import HTML2Text
 from django.template import mark_safe
@@ -39,7 +39,7 @@ class HTMLSanitizer(tokenizer.HTMLTokenizer, HTMLSanitizerMixin):
 
 def sanitize_html(html):
     """Sanitizes an HTML fragment."""
-    p = html5lib.HTMLParser(tokenizer=HTMLSanitizer,
+    p = HTMLParser(tokenizer=HTMLSanitizer,
                             tree=treebuilders.getTreeBuilder("dom"))
     dom_tree = p.parseFragment(html)
     walker = treewalkers.getTreeWalker("dom")