Commit 1e8f96f1 authored by Tres Seaver's avatar Tres Seaver

LP #496941: Remove all mention of ``standard_html_header`` and...

LP #496941:  Remove all mention of ``standard_html_header`` and ``standard_html_footer`` from default DTML content.
parent 839aeb97
......@@ -60,6 +60,9 @@ Features Added
Bugs Fixed
++++++++++
- LP #496941: Remove all mention of ``standard_html_header`` and
``standard_html_footer`` from default DTML content.
- LP #491249: fix tabindex on ZRDB connection test form.
- LP #490514: preserve tainting when calling into DTML from ZPT.
......
......@@ -175,10 +175,14 @@ class DTMLDocumentTopic(HelpTopicBase, DTMLDocument):
default_topic_content="""\
<dtml-var standard_html_header>
<html>
<head><title><dtml-var title_or_id></title>
</head>
<body bgcolor="#FFFFFF">
<h2><dtml-var title></h2>
<p>This is the <dtml-var id> Help Topic.</p>
<dtml-var standard_html_footer>
</body>
</html>
"""
class DTMLTopic(HelpTopic):
......@@ -239,9 +243,13 @@ class STXTopic(TextTopic):
return self.htmlfile(self, REQUEST)
htmlfile = HTML("""\
<dtml-var standard_html_header>
<dtml-var obj fmt="structured-text">
<dtml-var standard_html_footer>""")
<html>
<head><title><dtml-var title_or_id></title>
</head>
<body bgcolor="#FFFFFF">
<dtml-var obj fmt="structured-text">
</body>
</html>""")
class ReSTTopic(TextTopic):
......@@ -261,9 +269,13 @@ class ReSTTopic(TextTopic):
return self.htmlfile(self, REQUEST)
htmlfile = HTML("""\
<dtml-var standard_html_header>
<dtml-var obj fmt="restructured-text">
<dtml-var standard_html_footer>""")
<html>
<head><title><dtml-var title_or_id></title>
</head>
<body bgcolor="#FFFFFF">
<dtml-var obj fmt="restructured-text">
</body>
</html>""")
class ImageTopic(HelpTopic):
......
......@@ -157,12 +157,16 @@ class DTMLDocument(PropertyManager, DTMLMethod):
InitializeClass(DTMLDocument)
default_dd_html="""<dtml-var standard_html_header>
<h2><dtml-var title_or_id></h2>
default_dd_html="""<html>
<head><title><dtml-var title_or_id></title>
</head>
<body bgcolor="#FFFFFF">
<h2><dtml-var title_or_id></h2>
<p>
This is the <dtml-var id> Document.
</p>
<dtml-var standard_html_footer>"""
</body>
</html>"""
addForm=DTMLFile('dtml/documentAdd', globals())
......
......@@ -442,13 +442,17 @@ def decapitate(html, RESPONSE=None):
return html[spos + eolen:]
default_dm_html="""<dtml-var standard_html_header>
default_dm_html="""<html>
<head><title><dtml-var title_or_id></title>
</head>
<body bgcolor="#FFFFFF">
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
<p>
This is the <dtml-var document_id> Document
in the <dtml-var title_and_id> Folder.
</p>
<dtml-var standard_html_footer>"""
</body>
</html>"""
addForm=DTMLFile('dtml/methodAdd', globals())
......
......@@ -15,9 +15,32 @@ class DTMLDocumentTests(unittest.TestCase):
verifyClass(IWriteLock, self._getTargetClass())
class FactoryTests(unittest.TestCase):
def test_defaults_no_standard_html_header(self):
# see LP #496961
from OFS.DTMLDocument import addDTMLDocument
from OFS.DTMLDocument import DTMLDocument
dispatcher = DummyDispatcher()
addDTMLDocument(dispatcher, 'id')
method = dispatcher._set['id']
self.failUnless(isinstance(method, DTMLDocument))
self.failIf('standard_html_header' in method.read())
self.failIf('standard_html_footer' in method.read())
class DummyDispatcher:
def __init__(self):
self._set = {}
def _setObject(self, key, value):
self._set[key] = value
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(DTMLDocumentTests),
unittest.makeSuite(FactoryTests),
))
if __name__ == '__main__':
......
......@@ -15,9 +15,33 @@ class DTMLMethodTests(unittest.TestCase):
verifyClass(IWriteLock, self._getTargetClass())
class FactoryTests(unittest.TestCase):
def test_defaults_no_standard_html_header(self):
# see LP #496961
from OFS.DTMLMethod import addDTMLMethod
from OFS.DTMLMethod import DTMLMethod
dispatcher = DummyDispatcher()
addDTMLMethod(dispatcher, 'id')
method = dispatcher._set['id']
self.failUnless(isinstance(method, DTMLMethod))
self.failIf('standard_html_header' in method.read())
self.failIf('standard_html_footer' in method.read())
class DummyDispatcher:
def __init__(self):
self._set = {}
def _setObject(self, key, value):
self._set[key] = value
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(DTMLMethodTests),
unittest.makeSuite(FactoryTests),
))
if __name__ == '__main__':
......
......@@ -79,8 +79,9 @@ def manage_addZSearch(self, report_id, report_title, report_style,
self.manage_addDocument(
report_id,report_title,
('<dtml-var standard_html_header>\n%s\n'
'<dtml-var standard_html_footer>' %
('<html><head><title><dtml-var title_or_id></title>'
'</head><body bgcolor="#FFFFFF">\n%s\n'
'</body></html>' %
join(map(lambda q, report_style=report_style:
custom_default_report(q.id, q, no_table=report_style), qs),
'\n<hr>\n')))
......@@ -166,7 +167,8 @@ def default_input_form(arguments,action='query',
items=arguments.items()
return (
"%s\n%s%s" % (
'<dtml-var standard_html_header>\n%s\n'
'<html><head><title><dtml-var title_or_id></title>'
'</head><body bgcolor="#FFFFFF">\n%s\n'
'<form action="%s" method="get">\n'
'<h2><dtml-var document_title></h2>\n'
'Enter query parameters:<br>'
......@@ -193,18 +195,19 @@ def default_input_form(arguments,action='query',
'\n<tr><td colspan=2 align=center>\n'
'<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n'
'</td></tr>\n</table>\n</form>\n'
'<dtml-var standard_html_footer>\n'
'</body></html>\n'
)
)
else:
return (
'<dtml-var standard_html_header>\n%s\n'
'<html><head><title><dtml-var title_or_id></title>'
'</head><body bgcolor="#FFFFFF">\n%s\n'
'<form action="%s" method="get">\n'
'<h2><dtml-var document_title></h2>\n'
'This query requires no input.<p>\n'
'<input type="SUBMIT" name="SUBMIT" value="Submit Query">\n'
'</form>\n'
'<dtml-var standard_html_footer>\n'
'</body></html>\n'
% (tabs, action)
)
......
......@@ -245,8 +245,9 @@ def upload_html(object, f):
body = ("<!--#var standard_html_header-->\n\n" +
body + "\n\n<!--#var standard_html_footer-->")
else:
body = ("<dtml-var standard_html_header>\n\n" +
body + "\n\n<dtml-var standard_html_footer>")
body = ("<html><head><title><dtml-var title_or_id></title>
</head><body bgcolor="#FFFFFF">\n\n" +
body + "\n\n</body></html>")
else:
if old: f=f.read()
......
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