Luke Plant  committed c049127

Switched from ElementTree to lxml

  • Participants
  • Parent commits ee23d89

Comments (0)

Files changed (2)

File semanticeditor/

         super(TestCase, self).tearDown()
     def test_empty(self):
-        self.assertEqual('<div class="row" />', format_html('', {}));
+        self.assertEqual('<div class="row"/>', format_html('', {}));
     def test_no_headings(self):
         html = '<p>Test</p>'

File semanticeditor/utils/

 Utilities for manipulating the content provided by the user.
-from elementtree import ElementTree as ET
+from lxml import etree as ET
 from semanticeditor.utils.etree import cleanup, flatten, get_parent, get_depth, get_index, wrap_elements_in_tag, indent
 from semanticeditor.utils.datastructures import struct
 from xml.parsers import expat
 def parse(content):
         tree = ET.fromstring("<html>" + fixentities(content) + "</html>")
-    except expat.ExpatError, e:
+    except ET.XMLSyntaxError, e:
         raise InvalidHtml("HTML content is not well formed.")
     return tree