From 7c8b58dea309e334dc67c34c4758ac318107cd18 Mon Sep 17 00:00:00 2001 From: Paul Rodger Date: Tue, 7 May 2002 12:14:29 +0000 Subject: Fixed a bug where archivemail would abort if it got a date header with a completely blank value. --- CHANGELOG | 4 ++++ Makefile | 8 +++++++- TODO | 2 +- archivemail.py | 10 +++++----- setup.py | 2 +- test_archivemail.py | 9 +++++++++ 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 198005c..f2ecf7c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,8 @@ +Version 0.4.7 - ??? + * Fixed a bug where archivemail would abort if it received a date header + with a completely blank value. + Version 0.4.6 - 6 May 2002 * Fixed a bug where the os.rename() calls could fail if we were moving temporary files across different filesystems/partitions. diff --git a/Makefile b/Makefile index dea2285..8979dee 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -VERSION=0.4.6 +VERSION=0.4.7 VERSION_TAG=v$(subst .,_,$(VERSION)) TARFILE=archivemail-$(VERSION).tar.gz @@ -21,6 +21,12 @@ sdist: clobber doc cp archivemail.py archivemail fakeroot python setup.py sdist rm archivemail + +bdist_rpm: clobber doc + cp archivemail.py archivemail + fakeroot python setup.py bdist_rpm + rm archivemail + tag: cvs tag -F current cvs tag -F $(VERSION_TAG) diff --git a/TODO b/TODO index 31968e5..f11f40c 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ -Goals for next minor release (0.4.7): +Goals for next minor release (0.4.8): ------------------------------------- * Think about the best way to specify the names of archives created with possibly an --archive-name option. diff --git a/archivemail.py b/archivemail.py index 8020e89..dd19e0d 100755 --- a/archivemail.py +++ b/archivemail.py @@ -22,7 +22,7 @@ Website: http://archivemail.sourceforge.net/ """ # global administrivia -__version__ = "archivemail v0.4.6" +__version__ = "archivemail v0.4.7" __cvs_id__ = "$Id$" __copyright__ = """Copyright (C) 2002 Paul Rodger This is free software; see the source for copying conditions. There is NO @@ -670,14 +670,14 @@ def guess_delivery_time(message): # try to guess the delivery date from various headers # get more desparate as we go through the array for header in ('Delivery-date', 'Date', 'Resent-Date'): - date = message.getdate(header) - if date: - try: + try: + date = message.getdate(header) + if date: time_message = time.mktime(date) assert(time_message) vprint("using valid time found from '%s' header" % header) return time_message - except (ValueError, OverflowError): pass + except (IndexError, ValueError, OverflowError): pass # as a second-last resort, try the date from the 'From_' line (ugly) # this will only work from a mbox-format mailbox if (message.unixfrom): diff --git a/setup.py b/setup.py index 8c7a7f8..43743ec 100755 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ check_python_version() # define & run this early - 'distutils.core' is new from distutils.core import setup setup(name="archivemail", - version="0.4.6", + version="0.4.7", description="archive and compress old email", license="GNU GPL", url="http://archivemail.sourceforge.net/", diff --git a/test_archivemail.py b/test_archivemail.py index 18d6f4f..0af5f7a 100755 --- a/test_archivemail.py +++ b/test_archivemail.py @@ -563,6 +563,15 @@ This is after the ^From line""" 'Date' : None, 'Resent-Date' : 'Fri, 28 Jul 2000 16:11:36 +1000', }, + { # completely blank dates were crashing < version 0.4.7 + 'From_' : 'sender@dummy.domain Fri Jul 28 16:11:36 2000', + 'Date' : '', + }, + { # completely blank dates were crashing < version 0.4.7 + 'From_' : 'sender@dummy.domain Fri Jul 28 16:11:36 2000', + 'Date' : '', + 'Resent-Date' : '', + }, ) for headers in weird_headers: self.setUp() -- cgit v1.2.3