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-foal.git
The following commit(s) were added to refs/heads/master by this push:
new df37708 import-mbox should use same policy as archiver
df37708 is described below
commit df377080338de97857d1b3f1bb4b2d304f8816d0
Author: Sebb <[email protected]>
AuthorDate: Sat Nov 27 23:54:41 2021 +0000
import-mbox should use same policy as archiver
This fixes #164
---
tools/import-mbox.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index fc7e54f..9212838 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -237,10 +237,6 @@ class SlurpThread(Thread):
bad = 0
for key in messages.iterkeys():
- message = messages.get(key)
- if not message:
- self.printid("Message %u could not be extracted from %s,
ignoring it" % (key, tmpname))
- continue
file = messages.get_file(key, True)
# If the parsed data is filtered, also need to filter the raw
input
# so the source agrees with the summary info
@@ -248,6 +244,11 @@ class SlurpThread(Thread):
file = MboxoReader(file)
message_raw = file.read()
file.close()
+ message = email.message_from_bytes(message_raw,
policy=archiver.policy)
+ if not message:
+ self.printid("Message %u could not be extracted from %s,
ignoring it" % (key, tmpname))
+ continue
+
# If --filter is set, discard any messages not matching by
continuing to next email
if (
fromFilter