################################################################################
+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"):
+ yield uploader.strip()
+
@session_wrapper
def add_dsc_to_db(u, filename, session=None):
entry = u.pkg.files[filename]
session.refresh(source)
source.uploaders = [source.maintainer]
if u.pkg.dsc.has_key("uploaders"):
- for up in u.pkg.dsc["uploaders"].replace(">, ", ">\t").split("\t"):
- up = up.strip()
+ for up in split_uploaders(u.pkg.dsc["uploaders"]):
source.uploaders.append(get_or_set_maintainer(up, session))
session.flush()
--- /dev/null
+#!/usr/bin/env python
+
+from base_test import DakTestCase
+
+from daklib.dbconn import split_uploaders
+
+import unittest
+
+class SplitUploadersTestCase(DakTestCase):
+ def test_main(self):
+ 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)
+
+if __name__ == '__main__':
+ unittest.main()