Author: croberts
Date: 2012-03-01 19:18:05 +0000 (Thu, 01 Mar 2012)
New Revision: 5232
Modified:
trunk/cumin/bin/cumin-web
trunk/cumin/python/cumin/config.py
trunk/wooly/python/wooly/pages.py
trunk/wooly/python/wooly/pages.strings
Log:
Addressing BZ 785551 by adding an undocumented, unsupported config option
"force-html-doctype". adding "force-html-doctype: true" to cumin.conf
will result in pages that have the html content type and doctype, which should allow
selenium to work correctly with cumin's web pages. End users should never use this as
it causes the rendering engine to do some different, occasionally ugly things while
displaying the pages.
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2012-02-29 22:07:36 UTC (rev 5231)
+++ trunk/cumin/bin/cumin-web 2012-03-01 19:18:05 UTC (rev 5232)
@@ -142,6 +142,8 @@
cumin.notification_timeout = values.notification_timeout
+ cumin.force_html_doctype = values.force_html_doctype
+
cumin.fast_view_attributes = [x.strip() for x in
values.fast_view_attributes.split(',')]
# set default values for form inputs
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2012-02-29 22:07:36 UTC (rev 5231)
+++ trunk/cumin/python/cumin/config.py 2012-03-01 19:18:05 UTC (rev 5232)
@@ -57,6 +57,12 @@
param = ConfigParameter(web, "notification-timeout", int)
param.default = 180
+
+ # Hidden parameter used to force html doctype rather than xhtml
+ # This is hopefully a temporary workaround so that selenium can
+ # be used to do some automated testing against cumin
+ param = ConfigParameter(web, "force-html-doctype", bool)
+ param.default = False
def create_data_section(self, name, strict_section):
data = CuminConfigSection(self, name, strict_section)
Modified: trunk/wooly/python/wooly/pages.py
===================================================================
--- trunk/wooly/python/wooly/pages.py 2012-02-29 22:07:36 UTC (rev 5231)
+++ trunk/wooly/python/wooly/pages.py 2012-03-01 19:18:05 UTC (rev 5232)
@@ -115,7 +115,13 @@
# type (by their design), so we fall back to text/html
content_type = self.html_content_type
else:
- content_type = self.xhtml_content_type
+ # here, we look to enforce the hidden config option to force
+ # the html content type. This is used to make cumin compatible
+ # with selenium (a workaround for selenium bug).
+ if not self.app.force_html_doctype:
+ content_type = self.xhtml_content_type
+ else:
+ content_type = self.html_content_type
return content_type
@@ -150,6 +156,28 @@
def render_base_name(self, session):
return self.base_name
+
+ # The next 3 methods we look to enforce the hidden config option to force
+ # the html content type. This is used to make cumin compatible
+ # with selenium (a workaround for selenium bug). Ideally, someday
+ # we can return to xhtml
+ def render_xml_declaration(self, session):
+ if not self.app.force_html_doctype:
+ return self.xml_1_0_declaration
+ else:
+ return ""
+
+ def render_html_namespace(self, session):
+ if not self.app.force_html_doctype:
+ return """<html
xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en-US">"""
+ else:
+ return "<html>"
+
+ def render_doctype(self, session):
+ if not self.app.force_html_doctype:
+ return self.xhtml_1_1_doctype
+ else:
+ return self.html_doctype
class UpdatesAttribute(Attribute):
def get_default(self, session):
Modified: trunk/wooly/python/wooly/pages.strings
===================================================================
--- trunk/wooly/python/wooly/pages.strings 2012-02-29 22:07:36 UTC (rev 5231)
+++ trunk/wooly/python/wooly/pages.strings 2012-03-01 19:18:05 UTC (rev 5232)
@@ -1,7 +1,7 @@
[HtmlPage.html]
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+{xml_declaration}
+{doctype}
+{html_namespace}
<head>
<title>{title}</title>
@@ -28,8 +28,8 @@
<script type="text/javascript"
src="resource?name=jqplot.enhancedLegendRenderer.js"></script>
<script type="text/javascript"
src="resource?name=jqplot.highlighter.min.js"></script>
<script type="text/javascript"
src="resource?name=jqplot.cursor.js"></script>
- <script type="text/javascript"
src="resource?name=jqplot.dateAxisRenderer.js"></script>
-
+ <script type="text/javascript"
src="resource?name=jqplot.dateAxisRenderer.js"></script>
+
<script type="text/javascript">
$j = jQuery.noConflict();
// Code that uses other library's $ can follow here.