merge stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 21 Sep 2009 19:49:47 +0200
branchstable
changeset 3357 5aed5d6cd5d0
parent 3356 9ca73fbd3a58 (current diff)
parent 3352 83aabc5e3de3 (diff)
child 3358 0cddc4d8cad8
merge
--- a/common/uilib.py	Mon Sep 21 19:49:21 2009 +0200
+++ b/common/uilib.py	Mon Sep 21 19:49:47 2009 +0200
@@ -115,7 +115,7 @@
 try:
     from lxml import etree
 except (ImportError, AttributeError):
-    # gae environment: lxml not availabel
+    # gae environment: lxml not available
     pass
 else:
 
--- a/test/unittest_entity.py	Mon Sep 21 19:49:21 2009 +0200
+++ b/test/unittest_entity.py	Mon Sep 21 19:49:47 2009 +0200
@@ -356,6 +356,18 @@
         e['content'] = u'C&apos;est un exemple s&eacute;rieux'
         self.assertEquals(tidy(e.printable_value('content')),
                           u"C'est un exemple sérieux")
+        e['content'] = u'<div x:foo="bar">ms orifice produces weird html</div>'
+        self.assertEquals(tidy(e.printable_value('content')),
+                          u'<div>ms orifice produces weird html</div>')
+        import tidy as tidymod # apt-get install python-tidy
+        tidy = lambda x: str(tidymod.parseString(x.encode('utf-8'),
+                                                 **{'drop_proprietary_attributes': True,
+                                                    'output_xhtml': True,
+                                                    'show_body_only' : True,
+                                                    'quote-nbsp' : False,
+                                                    'char_encoding' : 'utf8'})).decode('utf-8').strip()
+        self.assertEquals(tidy(e.printable_value('content')),
+                          u'<div>ms orifice produces weird html</div>')
         # make sure valid xhtml is left untouched
         e['content'] = u'<div>R&amp;D<br/></div>'
         self.assertEquals(e.printable_value('content'), e['content'])