mirror of
https://git.code.sf.net/p/archivemail/code
synced 2025-03-12 07:42:50 +00:00
Simplify ArchiveMbox.__init__
This commit is contained in:
parent
df680c19be
commit
d6a161cd9e
1 changed files with 5 additions and 15 deletions
|
@ -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()
|
||||
temp_name = tempfile.mkstemp("archive.gz")[1]
|
||||
self.mbox_file = gzip.GzipFile(temp_name, "w")
|
||||
_stale.archive = temp_name
|
||||
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]
|
||||
_stale.archive = temp_name
|
||||
self.mbox_file = gzip.GzipFile(temp_name, "w")
|
||||
self.mbox_file_name = temp_name
|
||||
|
||||
def finalise(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue