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