diff options
author | W. Trevor King <wking@drexel.edu> | 2009-06-26 09:27:50 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-06-26 09:27:50 -0400 |
commit | 97aeb18b20f901950da0355471fdc17055f3f4a8 (patch) | |
tree | 83caecf530df36cc9f88bd94373b0fea0129b979 /xml | |
parent | 033a4446c1522c9ff288afa6bc47c3d15d290216 (diff) | |
download | bugseverywhere-97aeb18b20f901950da0355471fdc17055f3f4a8.tar.gz |
Added ability to handle non text/* MIME types.
The main problem was the encoding/decoding that was happening to _all_
input/output. Now many I/O activities have a `binary' option to
disable any encoding/decoding. The `binary' flag is set whenever the
comment content-type is not a text/* type.
In order to print valid XML (and make life easy on xml/be-xml-to-mbox),
non text/* types are printed out as base64-encoded MIME messages, so
be list --xml | be-xml-to-mbox | catmutt
works as you'd expect.
With the standard (non-XML) output from `be show', we just print a
message telling the user that we can't reasonably display the MIME
type and that they should use the XML output if they want to see it.
Diffstat (limited to 'xml')
-rwxr-xr-x | xml/be-xml-to-mbox | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/xml/be-xml-to-mbox b/xml/be-xml-to-mbox index b0a4cba..e5fec3b 100755 --- a/xml/be-xml-to-mbox +++ b/xml/be-xml-to-mbox @@ -116,14 +116,17 @@ class Comment (LimitedAttrDict): print "Message-ID: <%s@%s>" % (self["uuid"], DEFAULT_DOMAIN) print "Date: %s" % self["date"] print "From: %s" % self["from"] - print "Content-Type: %s; charset=%s" % (self["content-type"], DEFAULT_ENCODING) - print "Content-Transfer-Encoding: 8bit" print "Subject: %s: %s" % (self["short-name"], bug["summary"]) if "in-reply-to" not in self.keys(): self["in-reply-to"] = bug["uuid"] print "In-Reply-To: <%s@%s>" % (self["in-reply-to"], DEFAULT_DOMAIN) - print "" - print self["body"] + 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 "" class BE_list_handler (ContentHandler): |