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 ecde310 Allow access to policy from import-mbox
ecde310 is described below
commit ecde31068a00713d7586f7dbe681bac1f817b76f
Author: Sebb <[email protected]>
AuthorDate: Sat Nov 27 18:06:55 2021 +0000
Allow access to policy from import-mbox
---
tools/archiver.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tools/archiver.py b/tools/archiver.py
index c301253..9c065ca 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -92,6 +92,14 @@ if config.has_option("mailman", "plugin"):
# Access URL once archived
aURL = config.get("archiver", "baseurl")
+# Get/Set email parsing policy (primarily ascii/7bit vs native utf8)
+# (may be used by import-mbox)
+policy = email.policy.default # Default (8bit) lines in Python >=3.3
+policy_choice = config.get("archiver", "policy", fallback="default")
+if policy_choice == "strict":
+ policy = email.policy.compat32 # 7bit lines
+elif policy_choice == "smtputf8":
+ policy = email.policy.SMTPUTF8 # 8bit/unicode lines
def encode_base64(buff: bytes) -> str:
""" Convert bytes to base64 as text string (no newlines) """
@@ -969,13 +977,6 @@ def main():
try:
raw_message = input_stream.read()
- # Get/Set email parsing policy (primarily ascii/7bit vs native utf8)
- policy = email.policy.default # Default (8bit) lines in Python
>=3.3
- policy_choice = config.get("archiver", "policy", fallback="default")
- if policy_choice == "strict":
- policy = email.policy.compat32 # 7bit lines
- elif policy_choice == "smtputf8":
- policy = email.policy.SMTPUTF8 # 8bit/unicode lines
try:
msg = email.message_from_bytes(raw_message, policy=policy)
except Exception as err: