summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1999-09-08 23:09:40 +0000
committerbwarsaw1999-09-08 23:09:40 +0000
commitbb6c75c2cf3ec7746bc685d18d8f19a60f7f36e8 (patch)
treead6f8f9e934c535d54c9ca82a21c2a35c5ccefb2
parentabfb76a9bd2f5f71cdac76a2a14f3d61ab121440 (diff)
downloadmailman-bb6c75c2cf3ec7746bc685d18d8f19a60f7f36e8.tar.gz
mailman-bb6c75c2cf3ec7746bc685d18d8f19a60f7f36e8.tar.zst
mailman-bb6c75c2cf3ec7746bc685d18d8f19a60f7f36e8.zip
ParseMailCommands(): Quickie patch to allow quotes around the command
part of the email command. This means "help" [sic] works and you don't have to say: Send the word "help" (sans quotes) to ...
-rw-r--r--Mailman/MailCommandHandler.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Mailman/MailCommandHandler.py b/Mailman/MailCommandHandler.py
index cc9bc410a..8280dff4a 100644
--- a/Mailman/MailCommandHandler.py
+++ b/Mailman/MailCommandHandler.py
@@ -74,6 +74,8 @@ option_info = {'digest' : 0,
# ordered list
options = ('hide', 'nomail', 'ack', 'notmetoo', 'digest', 'plain')
+# strip just the outer layer of quotes
+quotecre = re.compile(r'["\'`](?P<cmd>.*)["\'`]')
class MailCommandHandler:
@@ -133,6 +135,10 @@ class MailCommandHandler:
return
if subject:
subject = string.strip(subject)
+ # remove quotes so "help" works
+ mo = quotecre.search(subject)
+ if mo:
+ subject = mo.group('cmd')
if (subject and
self.__dispatch.has_key(string.lower(string.split(subject)[0]))):
lines = [subject] + string.split(msg.body, '\n')
@@ -165,6 +171,10 @@ class MailCommandHandler:
continue
args = string.split(line)
cmd = string.lower(args[0])
+ # remove quotes so "help" or `help' works
+ mo = quotecre.search(cmd)
+ if mo:
+ cmd = mo.group('cmd')
args = args[1:]
if cmd in ['end', '--']:
self.AddToResponse('\n***** End: ' + line + '\n'