Commit 1f60a1d3 authored by Jérome Perrin's avatar Jérome Perrin

XXX temp commit to verify html validator works as expected

Revert "[erp5_xhtml_style/erp5_web] Switch from xhtml doctype to html5"

This reverts commit 825d990d.

Revert "testXHTML: use the nu validator by default"

This reverts commit 417ff1ae.

Revert "testXHTML: detect when w3 validator fails"

This reverts commit a5c5cf58.
parent c97ae082
......@@ -41,8 +41,8 @@
subject_list subject_list | python:here.getProperty('subject_list', []) or [];
">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" />
<!DOCTYPE html>
<html xml:lang="en" lang="en">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<tal:block metal:use-macro="global_definitions_macros/header_boilerplate" />
<tal:block metal:use-macro="global_definitions_macros/render_css_js" />
......
......@@ -18,7 +18,7 @@ DEPRECATION:
">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" />
<!DOCTYPE html>
<html xml:lang="en" lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<tal:block metal:use-macro="global_definitions_macros/header_boilerplate" />
<meta name="generator" content="ERP5 - Copyright (C) 2001 - 2015. All rights reserved." />
......
......@@ -581,27 +581,6 @@ class W3Validator(object):
parses the validation results, returns a list of tuples:
line_number, col_number, error description
"""
# Output is a set of headers then the XML content.
header_txt, body_txt = result.split('\n\n', 1)
# First, search the X-W3C headers
validator_status = 'Unknown'
error_count = -1
warning_count = -1
for header_line in header_txt.split('\n'):
if header_line.startswith('X-W3C-Validator-Status: '):
validator_status = header_line[len('X-W3C-Validator-Status: '):]
elif header_line.startswith('X-W3C-Validator-Errors: '):
error_count = int(header_line[len('X-W3C-Validator-Errors: '):])
elif header_line.startswith('X-W3C-Validator-Warnings: '):
warning_count = int(header_line[len('X-W3C-Validator-Warnings: '):])
if validator_status == 'Valid':
return [[], []]
if validator_status != 'Invalid':
return [[(None, None, 'Wrong validator status: %s' % validator_status)], []]
# Parsing is invalid
result_list_list = []
try:
xml_doc = minidom.parseString(result)
......@@ -627,8 +606,6 @@ class W3Validator(object):
result.append(None)
result_list.append(tuple(result))
result_list_list.append(result_list)
if (len(result_list_list[0]) != error_count) or (len(result_list_list[1]) != warning_count):
result_list_list[0].append((None, None, 'Could not parse all errors/warnings'))
return result_list_list
def getErrorAndWarningList(self, page_source):
......@@ -855,9 +832,10 @@ def addTestMethodDynamically(test_class, validator, target_business_templates):
tested_portal_type_list=tested_portal_type_list)
# Three validators are available : nu, tidy and the w3c validator
# It's hightly recommanded to use the nu validator which validates html5
validator_to_use = 'nu'
# Two validators are available : tidy and the w3c validator
# It's hightly recommanded to use the w3c validator because tidy dont show
# all errors and show more warnings that there is.
validator_to_use = 'w3c'
show_warnings = True
validator = None
......
......@@ -121,7 +121,8 @@ class ImageFieldWidget(Widget.TextWidget):
image = '%s?%s' % (image, parameters)
return Widget.render_element(
"img",
alt=alt,
# render images without `alt` to confirm w3-validator complains about it
# alt=alt,
src=image,
css_class=css_class,
extra=extra,
......
......@@ -35,9 +35,10 @@ class _ERP5(ERP5TypeTestSuite):
component_re = re.compile(".*/([^/]+)/TestTemplateItem/portal_components"
"/test\.[^.]+\.([^.]+).py$")
for test_path in (
glob('%s/product/*/tests/test*.py' % path) +
glob('%s/bt5/*/TestTemplateItem/test*.py' % path) +
glob('%s/bt5/*/TestTemplateItem/portal_components/test.*.test*.py' % path)):
glob('%s/product/*/tests/testXHTML.py' % path)
# glob('%s/bt5/*/TestTemplateItem/test*.py' % path) +
# glob('%s/bt5/*/TestTemplateItem/portal_components/test.*.test*.py' % path)
):
component_re_match = component_re.match(test_path)
if component_re_match is not None:
test_case = "%s:%s" % (component_re_match.group(1),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment