diff options
author | Nikolaus Schulz <microschulz@web.de> | 2010-07-31 14:58:50 +0200 |
---|---|---|
committer | Nikolaus Schulz <microschulz@web.de> | 2010-07-31 20:49:29 +0200 |
commit | 67f23e1af4a9adc43aea08790c4d3b349c75297d (patch) | |
tree | a464c426c6fd5586935beac56341d8e307035f0e /archivemail | |
parent | b6bc92c34f255054a7fd2128a024a5ae26cd1026 (diff) | |
download | archivemail-67f23e1af4a9adc43aea08790c4d3b349c75297d.tar.gz archivemail-67f23e1af4a9adc43aea08790c4d3b349c75297d.tar.bz2 archivemail-67f23e1af4a9adc43aea08790c4d3b349c75297d.zip |
Only use the default archive name suffix when the user specified no affix
Also add more archive name affix testing to the test suite.
Diffstat (limited to 'archivemail')
-rwxr-xr-x | archivemail | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/archivemail b/archivemail index 0ace88a..2ca862f 100755 --- a/archivemail +++ b/archivemail @@ -172,7 +172,8 @@ class StaleFiles: class Options: """Class to store runtime options, including defaults""" archive_prefix = None - archive_suffix = "_archive" + archive_suffix = None + archive_default_suffix = "_archive" days_old_max = 180 date_old_max = None delete_old_mail = False @@ -1636,10 +1637,13 @@ def make_archive_name(mailbox_name): else: tm = time.localtime(options.date_old_max) prefix = suffix = "" - if options.archive_prefix: - prefix = time.strftime(options.archive_prefix, tm) - if options.archive_suffix: - suffix = time.strftime(options.archive_suffix, tm) + if options.archive_prefix is None and options.archive_suffix is None: + suffix = options.archive_default_suffix + else: + if options.archive_prefix: + prefix = time.strftime(options.archive_prefix, tm) + if options.archive_suffix: + suffix = time.strftime(options.archive_suffix, tm) if re.match(r'imaps?://', mailbox_name.lower()): archive_dir = "" archive_base = mailbox_name.rsplit('/', 1)[-1] |