ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [07/11] incubator-ponymail git commit: remove defunct arguments; wire up iBody argument
Date Wed, 01 Jun 2016 12:41:09 GMT
remove defunct arguments; wire up iBody argument


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

Branch: refs/heads/master
Commit: 7135cd4a58a7d75ecdd9ba797479476b995326bd
Parents: 1ed519e
Author: Sam Ruby <rubys@intertwingly.net>
Authored: Thu May 5 07:56:44 2016 -0400
Committer: Sam Ruby <rubys@intertwingly.net>
Committed: Thu May 5 07:56:44 2016 -0400

----------------------------------------------------------------------
 tools/archiver.py    |  4 +++-
 tools/import-mbox.py | 12 +-----------
 2 files changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/7135cd4a/tools/archiver.py
----------------------------------------------------------------------
diff --git a/tools/archiver.py b/tools/archiver.py
index 991b6d6..b49472e 100644
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -60,6 +60,7 @@ config = configparser.RawConfigParser()
 config.read("%s/ponymail.cfg" % path)
 auth = None
 parseHTML = False
+iBody = None
 
 if config.has_section('mailman') and config.has_option('mailman', 'plugin'):
     from zope.interface import implementer
@@ -187,6 +188,7 @@ class Archiver(object):
     
     
     def msgbody(self, msg):
+        global iBody
         body = None
         firstHTML = None
         if msg.is_multipart():
@@ -211,7 +213,7 @@ class Archiver(object):
             firstHTML = msg.get_payload(decode=True)
             
         # this requires a GPL lib, user will have to install it themselves
-        if firstHTML and (not body or len(body) <= 1):
+        if firstHTML and (not body or len(body) <= 1 or (iBody and str(body).find(str(iBody))
!= -1)):
             body = self.html2text(firstHTML.decode("utf-8", 'ignore') if type(firstHTML)
is bytes else firstHTML)
     
         for charset in pm_charsets(msg):

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/7135cd4a/tools/import-mbox.py
----------------------------------------------------------------------
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 399afe6..2220f72 100644
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -59,12 +59,10 @@ source = "./"
 maildir = False
 list_override = None
 project = ""
-recursive = False
 filebased = False
 fileToLID = {}
 interactive = False
 extension = "*.mbox"
-attachments = False
 piperWeirdness = False
 parseHTML = False
 iBody = None
@@ -312,8 +310,6 @@ parser.add_argument('--source', dest='source', type=str, nargs=1,
                    help='Source to scan (either http(s):// or file path)')
 parser.add_argument('--dir', dest='dir', action='store_true',
                    help='Input is in Maildir format')
-parser.add_argument('--recursive', dest='recursive', action='store_true', 
-                   help='Do a recursive scan (sub dirs etc)')
 parser.add_argument('--interactive', dest='interactive', action='store_true',
                    help='Ask for help when possible')
 parser.add_argument('--quick', dest='quick', action='store_true',
@@ -332,8 +328,6 @@ parser.add_argument('--domain', dest='domain', type=str, nargs=1,
                    help='Optional domain extension for MIDs and List ID reconstruction)')
 parser.add_argument('--private', dest='private', action='store_true',
                    help='This is a privately archived list. Filter through auth proxy.')
-parser.add_argument('--attachments', dest='attachments', action='store_true',
-                   help='Also iport attached files in emails')
 parser.add_argument('--dry', dest='dry', action='store_true',
                    help='Do not save emails to elasticsearch, only test importing')
 parser.add_argument('--html2text', dest='html2text', action='store_true',
@@ -365,23 +359,19 @@ if args.project:
     project = args.project[0]
 if args.domain:
     appender = args.domain[0]
-if args.recursive:
-    recursive = args.recursive
 if args.interactive:
     interactive = args.interactive
 if args.quick:
     quickmode = args.quick
 if args.private:
     private = args.private
-if args.attachments:
-    attachments = args.attachments
 if args.ext:
     extension = args.ext[0]
 if args.html2text:
     import html2text
     parseHTML = True
 if args.ibody:
-    iBody = args.ibody[0]
+    archiver.iBody = args.ibody[0]
 if args.resend:
     resendTo = args.resend[0]
     from smtplib import SMTP


Mime
View raw message