ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: Add more useful output
Date Wed, 16 Nov 2016 20:25:02 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 49f408877 -> 2fb2fe473


Add more useful output

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

Branch: refs/heads/master
Commit: 2fb2fe4739efe5c2d9914c6b40f16cad1025216e
Parents: 49f4088
Author: Sebb <sebb@apache.org>
Authored: Wed Nov 16 20:24:51 2016 +0000
Committer: Sebb <sebb@apache.org>
Committed: Wed Nov 16 20:24:51 2016 +0000

----------------------------------------------------------------------
 tools/missing.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/2fb2fe47/tools/missing.py
----------------------------------------------------------------------
diff --git a/tools/missing.py b/tools/missing.py
index 9e2a3bc..83aa2a4 100755
--- a/tools/missing.py
+++ b/tools/missing.py
@@ -52,6 +52,12 @@ args = parser.parse_args()
 if args.wildcard and args.mid:
     parser.error("Cannot use --mid and --wildcard together")
 
+def getField(src,name):
+    try:
+        return src[name]
+    except KeyError:
+        return '(Uknown)'
+
 def update(elastic, js_arr):
     if args.debug:
         print(js_arr)
@@ -76,7 +82,7 @@ if args.missing:
     page = elastic.scan(# defaults to mbox
             scroll = scroll,
             body = {
-                "_source" : ['subject'],
+                "_source" : ['subject','message-id'],
                 "query" : {
                     "bool" : {
                         "must" : {
@@ -119,7 +125,8 @@ if args.missing:
                 'doc': body
             })
             count += 1
-            print("%s %s" %(doc,hit['_source']['subject']))
+            source = hit['_source']
+            print("Id: %s Msg-id: %s Subject: %s" %(doc, getField(source, 'message-id'),
getField(source,'subject')))
             if (count % 500 == 0):
                 print("Processed %u emails..." % count)
                 if setField:


Mime
View raw message