web/request.py
changeset 7187 496f51b92154
parent 7164 93a19c1831aa
child 7268 cd14e03124be
child 7273 a949fc438029
--- a/web/request.py	Wed Apr 06 10:10:21 2011 +0200
+++ b/web/request.py	Wed Apr 06 16:01:19 2011 +0200
@@ -756,8 +756,16 @@
         will display '<[' at the beginning of the page
         """
         self.set_content_type('text/html')
-        self.main_stream.doctype = TRANSITIONAL_DOCTYPE_NOEXT
-        self.main_stream.xmldecl = u''
+        self.main_stream.set_doctype(TRANSITIONAL_DOCTYPE_NOEXT)
+
+    def set_doctype(self, doctype, reset_xmldecl=True):
+        """helper method to dynamically change page doctype
+
+        :param doctype: the new doctype, e.g. '<!DOCTYPE html>'
+        :param reset_xmldecl: if True, remove the '<?xml version="1.0"?>'
+                              declaration from the page
+        """
+        self.main_stream.set_doctype(doctype, reset_xmldecl)
 
     # page data management ####################################################