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 2018/05/24 09:13:39 UTC
[incubator-ponymail] branch master updated: Bug: tmpname used
before it has been set up in import-mbox
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git
The following commit(s) were added to refs/heads/master by this push:
new ffe56ce Bug: tmpname used before it has been set up in import-mbox
ffe56ce is described below
commit ffe56ce66125440afcd54a279713e2142e45dae1
Author: Sebb <se...@apache.org>
AuthorDate: Thu May 24 10:13:37 2018 +0100
Bug: tmpname used before it has been set up in import-mbox
This fixes #458
---
CHANGELOG.md | 1 +
tools/import-mbox.py | 14 +++++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8068406..0517bec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
## Changes in 0.11-SNAPSHOT
+- Bug: tmpname used before it has been set up in import-mbox (#458)
- Bug: variable 'mid' used before assignment in archiver.py (#459)
- Enh: remove duplicated code in tools scripts by using elastic.py module (#456)
- Enh: separate module to read config file
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 8fab50e..08074c2 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -174,9 +174,7 @@ class SlurpThread(Thread):
stime = time.time()
dFile = False
- if maildir:
- messages = mailbox.Maildir(tmpname, create=False)
- elif imap:
+ if imap:
imap4 = mla[2]
def mailgen(list):
for uid in list:
@@ -204,7 +202,10 @@ class SlurpThread(Thread):
except Exception as err:
self.printid("This wasn't a gzip file: %s" % err )
self.printid("Slurping %s" % filename)
- messages = mailbox.mbox(tmpname, None if noMboxo else MboxoFactory, create=False)
+ if maildir:
+ messages = mailbox.Maildir(tmpname, create=False)
+ else:
+ messages = mailbox.mbox(tmpname, None if noMboxo else MboxoFactory, create=False)
else:
ml = mla[0]
@@ -216,7 +217,10 @@ class SlurpThread(Thread):
tmpname = hashlib.sha224(("%f-%f-%s-%s.mbox" % (random.random(), time.time(), ml, mboxfile)).encode('utf-8') ).hexdigest()
with open(tmpname, "w") as f:
f.write(inp)
- messages = mailbox.mbox(tmpname, None if noMboxo else MboxoFactory, create=False)
+ if maildir:
+ messages = mailbox.Maildir(tmpname, create=False)
+ else:
+ messages = mailbox.mbox(tmpname, None if noMboxo else MboxoFactory, create=False)
count = 0
bad = 0
--
To stop receiving notification emails like this one, please contact
sebb@apache.org.