[Zope-Checkins] SVN: Zope/trunk/ LP #496941: Remove all mention of ``standard_html_header`` and ``standard_html_footer`` from default DTML content.

Tres Seaver tseaver at palladion.com
Tue Dec 15 11:48:42 EST 2009


Log message for revision 106547:
  LP #496941:  Remove all mention of ``standard_html_header`` and ``standard_html_footer`` from default DTML content.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/HelpSys/HelpTopic.py
  U   Zope/trunk/src/OFS/DTMLDocument.py
  U   Zope/trunk/src/OFS/DTMLMethod.py
  U   Zope/trunk/src/OFS/tests/test_DTMLDocument.py
  U   Zope/trunk/src/OFS/tests/test_DTMLMethod.py
  U   Zope/trunk/src/Shared/DC/ZRDB/Search.py
  U   Zope/trunk/src/Zope2/utilities/load_site.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/doc/CHANGES.rst	2009-12-15 16:48:41 UTC (rev 106547)
@@ -60,6 +60,9 @@
 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.

Modified: Zope/trunk/src/HelpSys/HelpTopic.py
===================================================================
--- Zope/trunk/src/HelpSys/HelpTopic.py	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/src/HelpSys/HelpTopic.py	2009-12-15 16:48:41 UTC (rev 106547)
@@ -175,10 +175,14 @@
 
 
 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 @@
         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 @@
         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):

Modified: Zope/trunk/src/OFS/DTMLDocument.py
===================================================================
--- Zope/trunk/src/OFS/DTMLDocument.py	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/src/OFS/DTMLDocument.py	2009-12-15 16:48:41 UTC (rev 106547)
@@ -157,12 +157,16 @@
 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())
 

Modified: Zope/trunk/src/OFS/DTMLMethod.py
===================================================================
--- Zope/trunk/src/OFS/DTMLMethod.py	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/src/OFS/DTMLMethod.py	2009-12-15 16:48:41 UTC (rev 106547)
@@ -442,13 +442,17 @@
     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())
 

Modified: Zope/trunk/src/OFS/tests/test_DTMLDocument.py
===================================================================
--- Zope/trunk/src/OFS/tests/test_DTMLDocument.py	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/src/OFS/tests/test_DTMLDocument.py	2009-12-15 16:48:41 UTC (rev 106547)
@@ -15,9 +15,32 @@
         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__':

Modified: Zope/trunk/src/OFS/tests/test_DTMLMethod.py
===================================================================
--- Zope/trunk/src/OFS/tests/test_DTMLMethod.py	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/src/OFS/tests/test_DTMLMethod.py	2009-12-15 16:48:41 UTC (rev 106547)
@@ -15,9 +15,33 @@
         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__':

Modified: Zope/trunk/src/Shared/DC/ZRDB/Search.py
===================================================================
--- Zope/trunk/src/Shared/DC/ZRDB/Search.py	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/src/Shared/DC/ZRDB/Search.py	2009-12-15 16:48:41 UTC (rev 106547)
@@ -79,8 +79,9 @@
 
         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 @@
         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 @@
                 '\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)
             )
 

Modified: Zope/trunk/src/Zope2/utilities/load_site.py
===================================================================
--- Zope/trunk/src/Zope2/utilities/load_site.py	2009-12-15 16:37:34 UTC (rev 106546)
+++ Zope/trunk/src/Zope2/utilities/load_site.py	2009-12-15 16:48:41 UTC (rev 106547)
@@ -245,8 +245,9 @@
             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()



More information about the Zope-Checkins mailing list