]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
parsemail: Parse Mailman-formatted addresses
authorStephen Finucane <stephen.finucane@intel.com>
Wed, 16 Dec 2015 12:02:02 +0000 (12:02 +0000)
committerStephen Finucane <stephen.finucane@intel.com>
Wed, 16 Dec 2015 12:02:02 +0000 (12:02 +0000)
If loading archives from mailman, it is useful to parse and format
addresses such that they are proper emails.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/bin/parsemail.py

index 43d733f30ec8295f28f5ad2bef06d7e9e4159999..8870f62acab88a031378e528e5b219169c3518ce 100755 (executable)
@@ -127,6 +127,10 @@ def find_author(mail):
         # for example@example.com (Firstname Lastname) style addresses
         (re.compile(r'"?(.*?)"?\s*\(([^\)]+)\)'), (lambda g: (g[1], g[0]))),
 
+        # for example at example.com (Firstname Lastname) style addresses
+        (re.compile(r'(.*?)\sat\s(.*?)\s*\(([^\)]+)\)'),
+         (lambda g: (g[2], '@'.join(g[0:2])))),
+
         # everything else
         (re.compile(r'(.*)'), (lambda g: (None, g[0]))),
     ]