Commit 96fcfacf authored by Romain Courteaud's avatar Romain Courteaud

Handle timezone when parsing email date.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22967 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4ff69e6d
......@@ -28,7 +28,7 @@
import re, types
from DateTime import DateTime
from time import mktime
from time import mktime_tz
from Globals import get_request
from AccessControl import ClassSecurityInfo, Unauthorized
from Products.ERP5Type.Base import WorkflowMethod
......@@ -58,7 +58,7 @@ except ImportError:
from email import message_from_string
from email.Header import decode_header
from email.Utils import parsedate
from email.Utils import parsedate_tz
DEFAULT_TEXT_FORMAT = 'text/html'
COMMASPACE = ', '
......@@ -256,9 +256,9 @@ class EmailDocument(File, TextDocument):
return self._baseGetStartDate(default)
date_string = self.getContentInformation().get('Date', None)
if date_string:
parsed_date_string = parsedate(date_string)
parsed_date_string = parsedate_tz(date_string)
if parsed_date_string is not None:
time = mktime(parsed_date_string)
time = mktime_tz(parsed_date_string)
if time:
return DateTime(time)
return self.getCreationDate()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment