From 75e40a85c1553ccf22bf7de1790ed360c9215b0f Mon Sep 17 00:00:00 2001 From: bwarsaw <> Date: Sun, 29 Feb 2004 18:52:36 +0000 Subject: Load(): Before creating the .safety file, move any existing .pck or .db file to a .corrupt file, since it could not be read. This should eliminate the shutil EPERM exceptions. --- Mailman/MailList.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Mailman') diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 7b57c143..26ecd015 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -610,9 +610,19 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # copy the fallback into the primary so that the logic in Save() will # still work. For giggles, we'll copy it to a safety backup. if file == plast: + # Move aside any existing pickle file + try: + os.rename(pfile, pfile + '.corrupt') + except OSError, e: + if e.errno <> errno.ENOENT: raise shutil.copy(file, pfile) shutil.copy(file, pfile + '.safety') elif file == dlast: + # Move aside any existing marshal file + try: + os.rename(dfile, dfile + '.corrupt') + except OSError, e: + if e.errno <> errno.ENOENT: raise shutil.copy(file, dfile) shutil.copy(file, pfile + '.safety') # Copy the loaded dictionary into the attributes of the current -- cgit v1.2.3