This is an automated email from the ASF dual-hosted git repository.

humbedooh 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 29d7604  switch to textlib for normalize_lid
29d7604 is described below

commit 29d760490c367b8d01e81bfeaa02fe4ab4e0df40
Author: Daniel Gruno <[email protected]>
AuthorDate: Sun Sep 12 09:01:26 2021 -0500

    switch to textlib for normalize_lid
---
 tools/import-mbox.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index cb0cde6..0db1a0a 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -41,10 +41,12 @@ from urllib.request import urlopen
 
 if not __package__:
     import archiver
+    from plugins import textlib
     from plugins.elastic import Elastic
 else:
     from . import archiver
     from .plugins.elastic import Elastic
+    from .plugins import textlib
 
 TIMEOUT_DEFAULT = 600
 goodies = 0
@@ -548,7 +550,8 @@ if args.source:
 if args.dir:
     maildir = args.dir
 if args.listid:
-    list_override = archiver.normalize_lid(args.listid[0])
+    list_override = textlib.normalize_lid(args.listid[0], strict=True)
+    assert list_override is not None, "Invalid list-ID provided"
 if args.project:
     project = args.project[0]
 if args.domain:
@@ -621,7 +624,7 @@ def glob_dir(d):
         print("Would you like to set a list-ID override for %s?:" % d)
         lo = sys.stdin.readline()
         if lo and len(lo) > 3:
-            fileToLID[d] = archiver.normalize_lid(lo.strip("\r\n"))
+            fileToLID[d] = textlib.normalize_lid(lo.strip("\r\n"))
             print("Righto, setting it to %s." % fileToLID[d])
         else:
             print("alright, I'll try to figure it out myself!")

Reply via email to