aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Rodger <paul@paulrodger.com>2002-04-28 04:00:11 +0000
committerPaul Rodger <paul@paulrodger.com>2002-04-28 04:00:11 +0000
commit15be93bd0dd4865a88bc099c88157d9a70a7b099 (patch)
tree49d63d4a49348aca7c234938e753ee825efe6c7c
parentbc41b683898797b07db49a929656ed644cfefd53 (diff)
downloadarchivemail-15be93bd0dd4865a88bc099c88157d9a70a7b099.tar.gz
archivemail-15be93bd0dd4865a88bc099c88157d9a70a7b099.tar.bz2
archivemail-15be93bd0dd4865a88bc099c88157d9a70a7b099.zip
Fixed a bug where if you use the '--delete' option to completely clean
an mbox mailbox you would get a python error.
-rwxr-xr-xarchivemail.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/archivemail.py b/archivemail.py
index 30c06f5..846e9b0 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -223,10 +223,12 @@ class Options:
if is_world_writable(self.output_dir):
unexpected_error(("output directory is world-writable: " + \
"%s -- I feel nervous!") % self.output_dir)
- if (self.days_old_max < 1):
+ if self.days_old_max < 1:
user_error("argument to -d must be greater than zero")
- if (self.days_old_max >= 10000):
+ if self.days_old_max >= 10000:
user_error("argument to -d must be less than 10000")
+ if self.quiet and self.verbose:
+ user_error("you cannot use both the --quiet and --verbose options")
def date_argument(self, string):
"""Converts a date argument string into seconds since the epoch"""
@@ -868,6 +870,7 @@ def archive(mailbox_name):
os.path.basename(final_archive_name))
vprint("archiving '%s' to '%s' ..." % (mailbox_name, final_archive_name))
+ old_temp_dir = tempfile.tempdir
tempfile.tempdir = choose_temp_dir(mailbox_name)
assert(tempfile.tempdir)
vprint("set tempfile directory to '%s'" % tempfile.tempdir)
@@ -905,6 +908,7 @@ def archive(mailbox_name):
vprint("changing effective groupid and userid back to root")
os.setegid(0)
os.seteuid(0)
+ tempfile.tempdir = old_temp_dir
def _archive_mbox(mailbox_name, final_archive_name):
@@ -965,7 +969,7 @@ def _archive_mbox(mailbox_name, final_archive_name):
if options.delete_old_mail:
# we will never have an archive file
if retain:
- retain.finalise(mailbox_name)
+ retain.finalise()
else:
# nothing was retained - everything was deleted
original.leave_empty()