You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/10/31 22:11:38 UTC

incubator-ponymail git commit: Fetch generator type once

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 3cf4f1541 -> 059c79204


Fetch generator type once

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

Branch: refs/heads/master
Commit: 059c7920459b5f0c236e49ede59312679de321c9
Parents: 3cf4f15
Author: Sebb <se...@apache.org>
Authored: Mon Oct 31 22:11:30 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Mon Oct 31 22:11:30 2016 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/059c7920/tools/archiver.py
----------------------------------------------------------------------
diff --git a/tools/archiver.py b/tools/archiver.py
index 28bfeba..2102523 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -73,6 +73,8 @@ elif __name__ == '__main__':
 if config.has_option('elasticsearch', 'user'):
     auth = (config.get('elasticsearch','user'), config.get('elasticsearch','password'))
 
+archiver_generator = config.get("archiver", "generator", fallback="")
+
 def parse_attachment(part):
     cd = part.get("Content-Disposition", None)
     if cd:
@@ -296,9 +298,9 @@ class Archiver(object):
             pmid = mid
             try:
                 # Use full message as bytes for mid?
-                if config.has_section('archiver') and config.has_option("archiver", "generator") and config.get("archiver", "generator") == "full":
+                if archiver_generator == "full":
                     mid = "%s@%s" % (hashlib.sha224(msg.as_bytes()).hexdigest(), lid)
-                elif config.has_section('archiver') and config.has_option("archiver", "generator") and config.get("archiver", "generator") == "medium":
+                elif archiver_generator == "medium":
                     xbody = body if type(body) is bytes else body.encode('ascii', 'ignore')
                     xbody += bytes(lid, encoding='ascii')
                     xbody += bytes(mdatestring, encoding='ascii')