aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Archiver
diff options
context:
space:
mode:
authorYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-05-13 03:54:42 +0900
committerYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-05-13 03:54:42 +0900
commit92fe2d084b3db7c533b3860428afccec7af95036 (patch)
tree70b89624a61f75cb8efb7c10a9a37abe5fb7bb16 /Mailman/Archiver
parent0d0624665b0a1f1779e2fb7a670b39fd7509258f (diff)
parentd2145608089777cd27175763cf9f71ca2a3159f5 (diff)
downloadmailman2-92fe2d084b3db7c533b3860428afccec7af95036.tar.gz
mailman2-92fe2d084b3db7c533b3860428afccec7af95036.tar.xz
mailman2-92fe2d084b3db7c533b3860428afccec7af95036.zip
Merge lp:mailman/2.1 up to rev 1649
Diffstat (limited to 'Mailman/Archiver')
-rw-r--r--Mailman/Archiver/pipermail.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/Mailman/Archiver/pipermail.py b/Mailman/Archiver/pipermail.py
index 9c54bbd9..c03d43b3 100644
--- a/Mailman/Archiver/pipermail.py
+++ b/Mailman/Archiver/pipermail.py
@@ -16,6 +16,7 @@ __version__ = '0.09 (Mailman edition)'
VERSION = __version__
CACHESIZE = 100 # Number of slots in the cache
+from Mailman import mm_cfg
from Mailman import Errors
from Mailman.Mailbox import ArchiverMailbox
from Mailman.Logging.Syslog import syslog
@@ -230,21 +231,30 @@ class Article:
self.body = s.readlines()
def _set_date(self, message):
- def floatdate(header):
- missing = []
- datestr = message.get(header, missing)
- if datestr is missing:
+ def floatdate(datestr):
+ if not datestr:
return None
date = parsedate_tz(datestr)
try:
- return mktime_tz(date)
+ date = mktime_tz(date)
+ if (date < 0 or
+ date - time.time() >
+ mm_cfg.ARCHIVER_ALLOWABLE_SANE_DATE_SKEW
+ ):
+ return None
+ return date
except (TypeError, ValueError, OverflowError):
return None
- date = floatdate('date')
+ date = floatdate(message.get('date'))
+ if date is None:
+ date = floatdate(message.get('x-list-received-date'))
+ if date is None:
+ date = floatdate(re.sub(r'^.*;\s*', '',
+ message.get('received', ''), flags=re.S))
if date is None:
- date = floatdate('x-list-received-date')
+ date = floatdate(re.sub(r'From \s*\S+\s+', '',
+ message.get_unixfrom() or '' ))
if date is None:
- # What's left to try?
date = self._last_article_time + 1
self._last_article_time = date
self.date = '%011i' % date