From d6a161cd9e6e49e349f6bc5c4465dd0dbbf4f1ba Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Tue, 5 Aug 2008 21:18:36 +0200 Subject: Simplify ArchiveMbox.__init__ --- archivemail.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/archivemail.py b/archivemail.py index d2d07ca..2bb4bc9 100755 --- a/archivemail.py +++ b/archivemail.py @@ -535,23 +535,13 @@ class ArchiveMbox(Mbox): """ assert(final_name) if options.no_compress: - self.__init_uncompressed() + temp_name = tempfile.mkstemp("archive")[1] + self.mbox_file = open(temp_name, "w") else: - self.__init_compressed() - self.__final_name = final_name - - def __init_uncompressed(self): - """Used internally by __init__ when archives are uncompressed""" - temp_name = tempfile.mkstemp("archive")[1] - _stale.archive = temp_name - self.mbox_file = open(temp_name, "w") - self.mbox_file_name = temp_name - - def __init_compressed(self): - """Used internally by __init__ when archives are compressed""" - temp_name = tempfile.mkstemp("archive.gz")[1] + temp_name = tempfile.mkstemp("archive.gz")[1] + self.mbox_file = gzip.GzipFile(temp_name, "w") _stale.archive = temp_name - self.mbox_file = gzip.GzipFile(temp_name, "w") + self.__final_name = final_name self.mbox_file_name = temp_name def finalise(self): -- cgit v1.2.3