fix WebTest crash when view contains non ascii characters tls-sprint
authorFlorent <florent@secondweb.fr>
Fri, 24 Apr 2009 18:53:12 +0200
branchtls-sprint
changeset 1480 d3e3d527daf5
parent 1477 b056a49c16dc
child 1483 1367efbcd6a5
child 1487 7ea2d806de76
fix WebTest crash when view contains non ascii characters
devtools/htmlparser.py
--- a/devtools/htmlparser.py	Fri Apr 24 17:04:14 2009 +0200
+++ b/devtools/htmlparser.py	Fri Apr 24 18:53:12 2009 +0200
@@ -32,10 +32,10 @@
 
     def preprocess_data(self, data):
         """used to fix potential blockquote mess generated by docutils"""
-        if STRICT_DOCTYPE not in data:
+        if str(STRICT_DOCTYPE) not in data:
             return data
         # parse using transitional DTD
-        data = data.replace(STRICT_DOCTYPE, TRANSITIONAL_DOCTYPE)
+        data = data.replace(str(STRICT_DOCTYPE), str(TRANSITIONAL_DOCTYPE))
         tree = etree.fromstring(data, self.parser)
         namespace = tree.nsmap.get(None)
         # this is the list of authorized child tags for <blockquote> nodes
@@ -51,7 +51,7 @@
             parent = blockquote.getparent()
             parent.remove(blockquote)
         data = etree.tostring(tree)
-        return '<?xml version="1.0" encoding="UTF-8"?>%s\n%s' % (STRICT_DOCTYPE, data)
+        return '<?xml version="1.0" encoding="UTF-8"?>%s\n%s' % (str(STRICT_DOCTYPE), data)
 
    
 class SaxOnlyValidator(Validator):