]> git.decadent.org.uk Git - dak.git/blobdiff - daklib/textutils.py
Add by-hash support
[dak.git] / daklib / textutils.py
index 03df5d8590657c9273b5eb1e7fac05db2a0ce19c..b4646759a81b77dae865bc5e950c727e15778b18 100644 (file)
@@ -34,6 +34,8 @@ def force_to_utf8(s):
     Forces a string to UTF-8.  If the string isn't already UTF-8,
     it's assumed to be ISO-8859-1.
     """
+    if isinstance(s, unicode):
+        return s
     try:
         unicode(s, 'utf-8')
         return s
@@ -111,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()