aboutsummaryrefslogtreecommitdiffstats
path: root/interfaces
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-18 11:03:43 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-18 11:03:43 -0400
commit70c8a070bfa520d72f0a5b487ca3bb2574d6de1e (patch)
treead8b54d08dfa4801ebe67abf38f25ac961cbea39 /interfaces
parent111b5358db203c6d4116f285c7112353e03e79c9 (diff)
downloadbugseverywhere-70c8a070bfa520d72f0a5b487ca3bb2574d6de1e.tar.gz
be-handle-mail now handles non-text comments.
This required replacing both the codec-wrapped sys.stdin _and_ the raw sys.__stdin__ with StringIO(stdin). becommands/comment will use only one or the other depending on the comment's content type. Caveat: Get_body_type only grabs the body and type of the first non-mulitpart section, which may not be what the user expects. Todo: Add multiple comments for each part of a multipart message, like we do in interfaces/xml/be-mbox-to-xml.
Diffstat (limited to 'interfaces')
-rwxr-xr-xinterfaces/email/interactive/be-handle-mail6
1 files changed, 6 insertions, 0 deletions
diff --git a/interfaces/email/interactive/be-handle-mail b/interfaces/email/interactive/be-handle-mail
index 5409a37..e511a0b 100755
--- a/interfaces/email/interactive/be-handle-mail
+++ b/interfaces/email/interactive/be-handle-mail
@@ -147,10 +147,14 @@ def run_message(msg_text):
command_args = ["--alt-id", msg["message-id"]] + command_args
command_args.append("-")
stdin = body
+ if LOGFILE != None:
+ LOGFILE.write("len comment body: %d\n" % len(stdin))
info["command-args"] = command_args
# set stdin and catch stdout and stderr
if stdin != None:
new_stdin = StringIO.StringIO(stdin)
+ orig___stdin = sys.__stdin__
+ sys.__stdin__ = new_stdin
orig_stdin = sys.stdin
sys.stdin = new_stdin
new_stdout = codecs.getwriter(ENCODING)(StringIO.StringIO())
@@ -175,6 +179,8 @@ def run_message(msg_text):
err = InvalidCommand(msg, info, e)
# restore stdin, stdout, and stderr
if stdin != None:
+ sys.__stdin__ = new_stdin
+ sys.__stdin__ = orig___stdin
sys.stdin = orig_stdin
sys.stdout.flush()
sys.stderr.flush()