ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [1/2] incubator-ponymail git commit: fix legacy generator
Date Sun, 04 Jun 2017 22:28:54 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master d60cc3cca -> 2802e2905


fix legacy generator

if date was missing or invalid, this would have thrown
an exception, contrary to original code. Thanks for the
catch, sebb!


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/34d515d3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/34d515d3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/34d515d3

Branch: refs/heads/master
Commit: 34d515d30c60ddfb26393c8244a84927cd18e5b1
Parents: f0edfa1
Author: Daniel Gruno <humbedooh@apache.org>
Authored: Mon Jun 5 00:28:12 2017 +0200
Committer: Daniel Gruno <humbedooh@apache.org>
Committed: Mon Jun 5 00:28:12 2017 +0200

----------------------------------------------------------------------
 tools/generators.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/34d515d3/tools/generators.py
----------------------------------------------------------------------
diff --git a/tools/generators.py b/tools/generators.py
index af566fc..762ad13 100644
--- a/tools/generators.py
+++ b/tools/generators.py
@@ -65,8 +65,12 @@ def redundant(msg, body, lid, attachments):
 
 # Old school way of making IDs
 def legacy(msg, body, lid, attachments):
-    mdate = email.utils.parsedate_tz(msg.get('date'))
-    uid_mdate = email.utils.mktime_tz(mdate) # Only set if Date header is valid
+    uid_mdate = 0 # Default if no date found
+    try:
+        mdate = email.utils.parsedate_tz(msg.get('date'))
+        uid_mdate = email.utils.mktime_tz(mdate) # Only set if Date header is valid
+    except:
+        pass
     mid = "%s@%s@%s" % (hashlib.sha224(body if type(body) is bytes else body.encode('ascii',
'ignore')).hexdigest(), uid_mdate, lid)
     return mid
 


Mime
View raw message