Commits

Luke Plant committed f8e6eac

Fixes for pyquery 0.6.1

Comments (0)

Files changed (2)

semanticeditor/clean.py

             if (j > 0): # skip the first one
                 del node.attrib['id']
 
-    for x in ['p + br', 'p:empty']:
-        doc(x).remove()
+    doc('p + br').remove()
+    for par in doc('p:empty'):
+        if par.text is None  or par.text.strip() == "":
+            par.getparent().remove(par)
 
     # Removed elements can give problems which need to be fixed again.  We keep
     # iterating through this until we get the same answer!
     return t.replace(u'\xa0', u' ')
 
 
-def _clean_elem(d):
+def _clean_elem(i, d):
     for x in ['style', 'class']:
         try:
-            d.removeAttr(x)
+            del d.attrib[x]
         except KeyError:
             pass
     for elem in d:
         'Topic :: Internet :: WWW/HTTP',
         'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
     ],
-    install_requires = ['lxml >= 2.2.4', 'pyquery >= 0.3.1', 'django-cms >= 2.0'],
+    install_requires = ['lxml >= 2.2.4', 'pyquery >= 0.6.1', 'django-cms >= 2.0'],
 )