← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:dscfile-source-package-format-text into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:dscfile-source-package-format-text into launchpad:master.

Commit message:
Look up source package format names as text

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396660
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:dscfile-source-package-format-text into launchpad:master.
diff --git a/lib/lp/archiveuploader/dscfile.py b/lib/lp/archiveuploader/dscfile.py
index c0c8ce5..3962086 100644
--- a/lib/lp/archiveuploader/dscfile.py
+++ b/lib/lp/archiveuploader/dscfile.py
@@ -31,6 +31,7 @@ from debian.deb822 import (
     PkgRelation,
     )
 import scandir
+import six
 from zope.component import getUtility
 
 from lp.app.errors import NotFoundError
@@ -313,7 +314,8 @@ class DSCFile(SourceUploadFile, SignableTagFile):
 
         if self.format is None:
             raise EarlyReturnUploadError(
-                "Unsupported source format: %s" % self._dict['Format'])
+                "Unsupported source format: %s" %
+                six.ensure_str(self._dict['Format']))
 
     #
     # Useful properties.
@@ -333,7 +335,7 @@ class DSCFile(SourceUploadFile, SignableTagFile):
         """Return the DSC format."""
         try:
             return SourcePackageFormat.getTermByToken(
-                self._dict['Format']).value
+                six.ensure_text(self._dict['Format'])).value
         except LookupError:
             return None