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
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()