]> git.decadent.org.uk Git - dak.git/commitdiff
Improve splitting of Uploaders list.
authorTorsten Werner <twerner@debian.org>
Sun, 24 Jul 2011 13:18:55 +0000 (15:18 +0200)
committerTorsten Werner <twerner@debian.org>
Sun, 24 Jul 2011 13:18:55 +0000 (15:18 +0200)
Signed-off-by: Torsten Werner <twerner@debian.org>
daklib/dbconn.py
tests/test_split_uploaders.py

index f314b3f7ef37a2defaf51c6b127c269265bac648..64437561c67a67e31646bc2b96d20097149af727 100755 (executable)
@@ -2640,7 +2640,8 @@ def split_uploaders(uploaders_list):
     Split the Uploaders field into the individual uploaders and yield each of
     them. Beware: email addresses might contain commas.
     '''
-    for uploader in uploaders_list.replace(">, ", ">\t").split("\t"):
+    import re
+    for uploader in re.sub(">[ ]*,", ">\t", uploaders_list).split("\t"):
         yield uploader.strip()
 
 @session_wrapper
index 062fd35735cc0dc879d82d494423d7c715dfa927..fe6bd91e984d4224a0cfcb37c2d5eca462c9f7cd 100755 (executable)
@@ -11,6 +11,12 @@ class SplitUploadersTestCase(DakTestCase):
         expected = ['"A, B" <a@b.c>', 'D E <d@e.f>']
         l = list(split_uploaders('"A, B" <a@b.c>, D E <d@e.f>'))
         self.assertEqual(expected, l)
+        l = list(split_uploaders('"A, B" <a@b.c> , D E <d@e.f>'))
+        self.assertEqual(expected, l)
+        l = list(split_uploaders('"A, B" <a@b.c>,D E <d@e.f>'))
+        self.assertEqual(expected, l)
+        l = list(split_uploaders('"A, B" <a@b.c>   ,D E <d@e.f>'))
+        self.assertEqual(expected, l)
 
 if __name__ == '__main__':
     unittest.main()