summaryrefslogtreecommitdiff
path: root/Mailman/Queue/Switchboard.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/Queue/Switchboard.py')
-rw-r--r--Mailman/Queue/Switchboard.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Mailman/Queue/Switchboard.py b/Mailman/Queue/Switchboard.py
index fabb1d099..6f5cd6222 100644
--- a/Mailman/Queue/Switchboard.py
+++ b/Mailman/Queue/Switchboard.py
@@ -149,12 +149,20 @@ class Switchboard:
msg = email.message_from_string(msg, Message.Message)
return msg, data
- def finish(self, filebase):
+ def finish(self, filebase, preserve=False):
bakfile = os.path.join(self.__whichq, filebase + '.bak')
try:
- os.unlink(bakfile)
+ if preserve:
+ psvfile = os.path.join(config.SHUNTQUEUE_DIR,
+ filebase + '.psv')
+ # Create the directory if it doesn't yet exist.
+ Utils.makedirs(config.SHUNTQUEUE_DIR, 0770)
+ os.rename(bakfile, psvfile)
+ else:
+ os.unlink(bakfile)
except EnvironmentError, e:
- elog.exception('Failed to unlink backup file: %s', bakfile)
+ elog.exception('Failed to unlink/preserve backup file: %s',
+ bakfile)
def files(self, extension='.pck'):
times = {}