--- a/devtools/htmlparser.py Tue Jan 04 16:15:52 2011 +0100
+++ b/devtools/htmlparser.py Tue Jan 04 16:33:01 2011 +0100
@@ -15,9 +15,7 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""defines a validating HTML parser used in web application tests
-
-"""
+"""defines a validating HTML parser used in web application tests"""
import re
import sys
@@ -25,6 +23,7 @@
from lxml import etree
from cubicweb.view import STRICT_DOCTYPE, TRANSITIONAL_DOCTYPE
+
STRICT_DOCTYPE = str(STRICT_DOCTYPE)
TRANSITIONAL_DOCTYPE = str(TRANSITIONAL_DOCTYPE)
@@ -51,10 +50,7 @@
def __init__(self):
Validator.__init__(self)
# XXX understand what's happening under windows
- validate = True
- if sys.platform == 'win32':
- validate = False
- self.parser = etree.XMLParser(dtd_validation=validate)
+ self.parser = etree.XMLParser(dtd_validation=sys.platform != 'win32')
def preprocess_data(self, data):
"""used to fix potential blockquote mess generated by docutils"""
@@ -87,6 +83,7 @@
Validator.__init__(self)
self.parser = etree.XMLParser()
+
class XMLDemotingValidator(SaxOnlyValidator):
""" some views produce html instead of xhtml, using demote_to_html