CVS: Products/ParsedXML - ExtraDOM.py:1.13 ManageableDOM.py:1.115

Martijn Faassen <[email protected]> Tue, 27 Apr 2004 14:05:29 -0400
Newsgroups gmane.comp.web.zope.parsed-xml
Message-ID <[email protected]>
Update of /cvs-repository/Products/ParsedXML
In directory cvs.zope.org:/tmp/cvs-serv5763

Modified Files:
	ExtraDOM.py ManageableDOM.py 
Log Message:
Get rid of more unused code paths with HTML support.


=== Products/ParsedXML/ExtraDOM.py 1.12 => 1.13 ===
--- Products/ParsedXML/ExtraDOM.py:1.12	Tue Apr 27 13:59:18 2004
+++ Products/ParsedXML/ExtraDOM.py	Tue Apr 27 14:05:28 2004
@@ -52,12 +52,12 @@
         return parent.insertBefore(fragment.firstChild, sib) # frag.firstChild
          
 
-def writeStream(node, stream = None, encoding = None, html = 0,
-                contentType = None, prettyPrint = 0):
+def writeStream(node, stream = None, encoding=None, prettyPrint = 0):
     "Write the XML representation of node to stream."
     if stream is None:
         stream = StringIO()
-    PrettyPrinter.PrintVisitor(node, stream, prettyPrint=prettyPrint)()
+    PrettyPrinter.PrintVisitor(
+        node, stream, encoding, prettyPrint=prettyPrint)()
     return stream
 
     


=== Products/ParsedXML/ManageableDOM.py 1.114 => 1.115 ===
--- Products/ParsedXML/ManageableDOM.py:1.114	Tue Apr 27 13:59:18 2004
+++ Products/ParsedXML/ManageableDOM.py	Tue Apr 27 14:05:28 2004
@@ -232,12 +232,11 @@
 class DOMIO:
     "Mixin class for DOM classes to provide parsing, writing."
 
-    def writeStream(self, stream = None, encoding = None, html = 0,
-                    contentType = None, prettyPrint=0):
+    def writeStream(self, stream=None, encoding=None, prettyPrint=0):
         "Write the XML representation of this object to stream."
         # work thru DOM object to avoid making proxy nodes
         return ExtraDOM.writeStream(self.getDOMObj(), stream, encoding,
-                                    html, contentType, prettyPrint=prettyPrint)
+                                    prettyPrint=prettyPrint)
     
     def __str__(self):
         "Return the XML representation of this object."
@@ -268,6 +267,7 @@
 
     def index_html(self, REQUEST = None, RESPONSE = None):
         "Returns publishable source according to content type"
+        # set content type header for raw XML if necessary
         if RESPONSE:
             if self._persistentDoc:
                 contentType = self._persistentDoc.contentType
@@ -275,10 +275,7 @@
                 contentType = 'text/xml'
             contentType = contentType + ';charset=utf-8'
             RESPONSE.setHeader('Content-Type', contentType)
-        type = string.split(contentType, '/')[1]
-        # the printer can do html mode xml, but we set according to type
-        isHtml = (type == "html")
-        return self.writeStream(None, None, isHtml, type).getvalue()
+        return self.writeStream(None).getvalue()
 
     # Parsing a node removes self & subtree from document; users of other
     # refs to subnodes have to take care to notice this.