diff options
author | bwarsaw <> | 2004-02-29 18:52:36 +0000 |
---|---|---|
committer | bwarsaw <> | 2004-02-29 18:52:36 +0000 |
commit | 75e40a85c1553ccf22bf7de1790ed360c9215b0f (patch) | |
tree | 870380aca94976a967ce03e798a9b59ed7963112 /Mailman | |
parent | c8d9db46a1648317561a187be1d22e8bdcd3a293 (diff) | |
download | mailman2-75e40a85c1553ccf22bf7de1790ed360c9215b0f.tar.gz mailman2-75e40a85c1553ccf22bf7de1790ed360c9215b0f.tar.xz mailman2-75e40a85c1553ccf22bf7de1790ed360c9215b0f.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | Mailman/MailList.py | 10 |
1 files changed, 10 insertions, 0 deletions
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 |