diff options
author | Lisa Junger <ljunger@thoughtworks.com> | 2015-04-02 09:55:07 +0200 |
---|---|---|
committer | Lisa Junger <ljunger@thoughtworks.com> | 2015-04-02 17:54:21 +0200 |
commit | f11d9b2811373de173f0e02ec334c85e46571172 (patch) | |
tree | dd814bf759e918e509f11d889f106ff0aa81a11b /service/pixelated | |
parent | db5a88affdf696b833619d18cbcfdd408f206150 (diff) |
when receiving invalid data for date header, fall back to datetime.now.
- Issue #347
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/model/mail.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/service/pixelated/adapter/model/mail.py b/service/pixelated/adapter/model/mail.py index e11c4048..ff58b330 100644 --- a/service/pixelated/adapter/model/mail.py +++ b/service/pixelated/adapter/model/mail.py @@ -21,6 +21,7 @@ from email.header import decode_header from leap.mail.imap.fields import fields import leap.mail.walk as walk import dateutil.parser as dateparser +from datetime import datetime from pixelated.adapter.model.status import Status import pixelated.support.date from email.MIMEMultipart import MIMEMultipart @@ -291,7 +292,10 @@ class PixelatedMail(Mail): for header in ['From', 'Subject']: _headers[header] = self._decode_header(hdoc_headers.get(header)) - _headers['Date'] = self._get_date() + try: + _headers['Date'] = self._get_date() + except Exception, e: + _headers['Date'] = pixelated.support.date.iso_now() if self.parts and len(self.parts['alternatives']) > 1: _headers['content_type'] = 'multipart/alternative; boundary="%s"' % self.boundary |