summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorLisa Junger <ljunger@thoughtworks.com>2015-04-02 09:55:07 +0200
committerLisa Junger <ljunger@thoughtworks.com>2015-04-02 17:54:21 +0200
commitf11d9b2811373de173f0e02ec334c85e46571172 (patch)
treedd814bf759e918e509f11d889f106ff0aa81a11b /service/pixelated
parentdb5a88affdf696b833619d18cbcfdd408f206150 (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.py6
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