ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [1/3] incubator-ponymail git commit: Generate a 10-tuple when date parsing fails
Date Wed, 13 Jul 2016 11:36:52 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/0.9 9881edb4f -> 116797982


Generate a 10-tuple when date parsing fails

Currently, we are only generating a 9-tuple, which causes
mktime_tz to fail. This fixes it by appending a (fake) TZ
to the tuple.


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

Branch: refs/heads/0.9
Commit: c20fc79bc971d743bc62e1b241c412277d254442
Parents: 000c8b7
Author: Daniel Gruno <humbedooh@apache.org>
Authored: Wed Jul 13 11:30:47 2016 +0200
Committer: Daniel Gruno <humbedooh@apache.org>
Committed: Wed Jul 13 11:30:47 2016 +0200

----------------------------------------------------------------------
 tools/archiver.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/c20fc79b/tools/archiver.py
----------------------------------------------------------------------
diff --git a/tools/archiver.py b/tools/archiver.py
index 36b9227..b3e87d8 100644
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -270,7 +270,8 @@ class Archiver(object):
             mdate = email.utils.parsedate_tz(msg_metadata.get('archived-at'))
         elif not mdate:
             print("Date seems totally wrong, setting to _now_ instead.")
-            mdate = time.gmtime()
+            mdate = time.gmtime() # Get a standard 9-tuple
+            mdate = mdate + (0, ) # Fake a TZ (10th element)
         mdatestring = time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(email.utils.mktime_tz(mdate)))
         body = self.msgbody(msg)
         try:


Mime
View raw message