Fix be-xml-to-mbox handling of non-text/* content types
authorW. Trevor King <wking@drexel.edu>
Tue, 2 Feb 2010 17:37:32 +0000 (12:37 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 2 Feb 2010 17:37:32 +0000 (12:37 -0500)
misc/xml/be-xml-to-mbox

index e2c870060417eb9a84a855c9c51bd5f4d78dbfac..c8b7479a7a3acf160bcf168488ebe7bde3d7c493 100755 (executable)
@@ -91,7 +91,8 @@ class Bug (LimitedAttrDict):
             print "Message-id: <%s@%s>" % (self["uuid"], DEFAULT_DOMAIN)
             print "Date: %s" % self["created"]
             print "From: %s" % self["creator"]
-            print "Content-Type: %s; charset=%s" % ("text/plain", DEFAULT_ENCODING)
+            print "Content-Type: %s; charset=%s" \
+                % ("text/plain", DEFAULT_ENCODING)
             print "Content-Transfer-Encoding: 8bit"
             print "Subject: %s: %s" % (self["short-name"], self["summary"])
             if "extra-strings" in self:
@@ -168,11 +169,13 @@ class Comment (LimitedAttrDict):
                 print "X-Extra-String: %s" % estr
         if self["content-type"].startswith("text/"):
             print "Content-Transfer-Encoding: 8bit"
-            print "Content-Type: %s; charset=%s" % (self["content-type"], DEFAULT_ENCODING)
-            print ""
-            print self["body"]
-        else: # content type and transfer encoding already in XML MIME output
-            print self["body"]
+            print "Content-Type: %s; charset=%s" \
+                % (self["content-type"], DEFAULT_ENCODING)
+        else:
+            print "Content-Transfer-Encoding: base64"
+            print "Content-Type: %s;" % (self["content-type"])
+        print ""
+        print self["body"]
         print ""
     def init_from_etree(self, element):
         assert element.tag == "comment", element.tag