aboutsummaryrefslogtreecommitdiffstats
path: root/interfaces/email/interactive
diff options
context:
space:
mode:
Diffstat (limited to 'interfaces/email/interactive')
-rw-r--r--interfaces/email/interactive/README12
-rwxr-xr-xinterfaces/email/interactive/be-handle-mail8
-rw-r--r--interfaces/email/interactive/examples/failing_multiples10
3 files changed, 14 insertions, 16 deletions
diff --git a/interfaces/email/interactive/README b/interfaces/email/interactive/README
index 87959e6..8954383 100644
--- a/interfaces/email/interactive/README
+++ b/interfaces/email/interactive/README
@@ -86,12 +86,10 @@ Controlling bugs
This interface consists of a list of allowed be commands, with one
command per line. Blank lines and lines beginning with '#' are
-ignored, as well anything following a line starting with '--'. All the
-listed commands are executed in order and their output returned.
-Note that currently arguments are split on spaces, so
- "John Doe" -> ['"John', 'Doe"']
-I'm thinking about how to fix this, but for the time being it's best
-to avoid spaces.
+ignored, as well anything following a line starting with '--'. All
+the listed commands are executed in order and their output returned.
+The commands are split into arguments with the POSIX-compliant
+shlex.split().
From jdoe@example.com Fri Apr 18 12:00:00 2008
From: John Doe <jdoe@example.com>
@@ -100,7 +98,7 @@ to avoid spaces.
Content-Transfer-Encoding: 8bit
Subject: [be-bug] I'll handle XYZ by release 1.2.3
- assign XYZ John
+ assign XYZ "John Doe <jdoe@example.com>"
status XYZ assigned
severity XYZ critical
target XYZ 1.2.3
diff --git a/interfaces/email/interactive/be-handle-mail b/interfaces/email/interactive/be-handle-mail
index d1c9451..f457b6a 100755
--- a/interfaces/email/interactive/be-handle-mail
+++ b/interfaces/email/interactive/be-handle-mail
@@ -42,17 +42,19 @@ import cStringIO as StringIO
import email
from email.mime.multipart import MIMEMultipart
import email.utils
-import libbe.cmdutil, libbe.encoding, libbe.utility
import os
import os.path
import re
-import send_pgp_mime
+import shlex
import sys
import time
import traceback
import doctest
import unittest
+import libbe.cmdutil, libbe.encoding, libbe.utility
+import send_pgp_mime
+
HANDLER_ADDRESS = u"BE Bugs <wking@thor.physics.drexel.edu>"
_THIS_DIR = os.path.abspath(os.path.dirname(__file__))
BE_DIR = _THIS_DIR
@@ -452,7 +454,7 @@ class Message (object):
continue
if line.startswith(BREAK):
break
- fields = line.split()
+ fields = shlex.split(line)
command,args = (fields[0], fields[1:])
commands.append(Command(self, command, args))
if len(commands) == 0:
diff --git a/interfaces/email/interactive/examples/failing_multiples b/interfaces/email/interactive/examples/failing_multiples
index ebe5406..cf50211 100644
--- a/interfaces/email/interactive/examples/failing_multiples
+++ b/interfaces/email/interactive/examples/failing_multiples
@@ -1,4 +1,4 @@
-From jdoe@example.com Fri Apr 18 11:18:58 2008
+From jdoe@example.com Fri Apr 18 12:00:00 2008
Message-ID: <abcd@example.com>
Date: Fri, 18 Apr 2008 12:00:00 +0000
From: John Doe <jdoe@example.com>
@@ -6,13 +6,11 @@ Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [be-bug] Commit message...
-new "test_bug"
-new "test_bug_2"
+new "test bug"
+new "test bug 2"
failing-command
-new "test_bug_3"
+new "test bug 3"
--
This message fails partway through, but the partial changes should be
recorded in a commit...
-
-Note the lack of spaces in the bug summary strings.