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 2017/01/29 14:09:54 UTC
incubator-ponymail git commit: Do the cheaper checks first
Repository: incubator-ponymail
Updated Branches:
refs/heads/master f825b3615 -> 7d550b4ce
Do the cheaper checks first
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/7d550b4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/7d550b4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/7d550b4c
Branch: refs/heads/master
Commit: 7d550b4ce6d212ed94b7877d9b2c5397fba6af74
Parents: f825b36
Author: Sebb <se...@apache.org>
Authored: Sun Jan 29 14:09:45 2017 +0000
Committer: Sebb <se...@apache.org>
Committed: Sun Jan 29 14:09:45 2017 +0000
----------------------------------------------------------------------
tools/archiver.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/7d550b4c/tools/archiver.py
----------------------------------------------------------------------
diff --git a/tools/archiver.py b/tools/archiver.py
index 3fa98f2..eafe5a3 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -211,19 +211,24 @@ class Archiver(object):
firstHTML = None
if msg.is_multipart():
for part in msg.walk():
+ """
+ find the first body part and the first HTML part
+ Note: cannot use break here because firstHTML is needed
+ if len(body) <= 1
+ """
try:
if part.is_multipart():
for subpart in part.walk():
- if subpart.get_content_type() == 'text/plain' and not body:
+ if not body and subpart.get_content_type() == 'text/plain':
body = subpart.get_payload(decode=True)
- if subpart.get_content_type() == 'text/enriched' and not body:
+ if not body and subpart.get_content_type() == 'text/enriched':
body = subpart.get_payload(decode=True)
- elif self.html and subpart.get_content_type() == 'text/html' and not firstHTML:
+ elif self.html and not firstHTML and subpart.get_content_type() == 'text/html':
firstHTML = subpart.get_payload(decode=True)
- elif part.get_content_type() == 'text/plain' and not body:
+ elif not body and part.get_content_type() == 'text/plain':
body = part.get_payload(decode=True)
- elif self.html and part.get_content_type() == 'text/html' and not firstHTML:
+ elif self.html and not firstHTML and part.get_content_type() == 'text/html':
firstHTML = part.get_payload(decode=True)
except Exception as err:
print(err)