summaryrefslogtreecommitdiff
path: root/Mailman/Queue/CommandRunner.py
diff options
context:
space:
mode:
authorbwarsaw2002-03-15 18:18:43 +0000
committerbwarsaw2002-03-15 18:18:43 +0000
commit02d14d885ae807aa54eb1e14b18d34ddc58351d4 (patch)
treec9852c1a1dd12b6d7b4c7f733534126c7c413f35 /Mailman/Queue/CommandRunner.py
parent65070745f9022b191363feccd37e7c8bd490c4b5 (diff)
downloadmailman-02d14d885ae807aa54eb1e14b18d34ddc58351d4.tar.gz
mailman-02d14d885ae807aa54eb1e14b18d34ddc58351d4.tar.zst
mailman-02d14d885ae807aa54eb1e14b18d34ddc58351d4.zip
Diffstat (limited to 'Mailman/Queue/CommandRunner.py')
-rw-r--r--Mailman/Queue/CommandRunner.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/Mailman/Queue/CommandRunner.py b/Mailman/Queue/CommandRunner.py
index 3b2221e45..759ebd101 100644
--- a/Mailman/Queue/CommandRunner.py
+++ b/Mailman/Queue/CommandRunner.py
@@ -23,6 +23,9 @@
+# BAW: get rid of this when we Python 2.2 is a minimum requirement.
+from __future__ import nested_scopes
+
import re
from Mailman import mm_cfg
@@ -54,25 +57,29 @@ class CommandRunner(Runner):
# mylist-join, or mylist-leave, and the message metadata will contain
# a key to which one was used. BAW: The tojoin and toleave actions
# are hacks!
+ def parsecmd():
+ try:
+ mlist.ParseMailCommands(msg, msgdata)
+ except LockFile.TimeOutError:
+ # We probably could not get the lock on the pending
+ # database. That's okay, we'll just try again later.
+ return 1
+ return 0
try:
+ status = 0
if msgdata.get('torequest'):
# Just pass the message off the command handler
- mlist.ParseMailCommands(msg, msgdata)
+ status = parsecmd()
elif msgdata.get('tojoin'):
del msg['subject']
msg['Subject'] = 'join'
msg.set_payload('')
- mlist.ParseMailCommands(msg, msgdata)
+ status = parsecmd()
elif msgdata.get('toleave'):
del msg['subject']
msg['Subject'] = 'leave'
msg.set_payload('')
- try:
- mlist.ParseMailCommands(msg, msgdata)
- except LockFile.TimeOutError:
- # We probably could not get the lock on the pending
- # database. That's okay, we'll just try again later.
- return 1
+ status = parsecmd()
elif msgdata.get('toconfirm'):
mo = re.match(mm_cfg.VERP_CONFIRM_REGEXP, msg.get('to', ''))
if mo:
@@ -81,7 +88,8 @@ class CommandRunner(Runner):
# command handling.
del msg['subject']
msg['Subject'] = 'confirm ' + mo.group('cookie')
- mlist.ParseMailCommands(msg, msgdata)
+ status = parsecmd()
mlist.Save()
+ return status
finally:
mlist.Unlock()