From: Ansgar Burchardt Date: Mon, 27 Aug 2012 21:08:12 +0000 (+0200) Subject: move split_uploaders function to daklib.textutils X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea17e27345ee692a78f80b0a3717444a37c775b9;p=dak move split_uploaders function to daklib.textutils This allows the test suite to test split_uploaders again. --- diff --git a/daklib/archive.py b/daklib/archive.py index 08f59883..aeca0a00 100644 --- a/daklib/archive.py +++ b/daklib/archive.py @@ -361,11 +361,7 @@ class ArchiveTransaction(object): # Uploaders are the maintainer and co-maintainers from the Uploaders field db_source.uploaders.append(maintainer) if 'Uploaders' in control: - def split_uploaders(field): - import re - for u in re.sub(">[ ]*,", ">\t", field).split("\t"): - yield u.strip() - + from daklib.textutils import split_uploaders for u in split_uploaders(control['Uploaders']): db_source.uploaders.append(get_or_set_maintainer(u, session)) session.flush() diff --git a/daklib/textutils.py b/daklib/textutils.py index c9cc4ed3..b4646759 100644 --- a/daklib/textutils.py +++ b/daklib/textutils.py @@ -113,3 +113,8 @@ def fix_maintainer(maintainer): return (rfc822_maint, rfc2047_maint, name, email) ################################################################################ + +def split_uploaders(field): + import re + for u in re.sub(">[ ]*,", ">\t", field).split("\t"): + yield u.strip() diff --git a/tests/test_split_uploaders.py b/tests/test_split_uploaders.py index fe6bd91e..51812da0 100755 --- a/tests/test_split_uploaders.py +++ b/tests/test_split_uploaders.py @@ -2,7 +2,7 @@ from base_test import DakTestCase -from daklib.dbconn import split_uploaders +from daklib.textutils import split_uploaders import unittest