From 15be93bd0dd4865a88bc099c88157d9a70a7b099 Mon Sep 17 00:00:00 2001 From: Paul Rodger Date: Sun, 28 Apr 2002 04:00:11 +0000 Subject: Fixed a bug where if you use the '--delete' option to completely clean an mbox mailbox you would get a python error. --- archivemail.py | 10 +++++++--- 1 file 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() -- cgit v1.2.3