← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-six-string-types into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-six-string-types into launchpad:master.

Commit message:
Replace (str, unicode) with six.string_types

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/392126
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-six-string-types into launchpad:master.
diff --git a/lib/lp/services/database/tests/test_isolation.py b/lib/lp/services/database/tests/test_isolation.py
index f5024cc..f73f684 100644
--- a/lib/lp/services/database/tests/test_isolation.py
+++ b/lib/lp/services/database/tests/test_isolation.py
@@ -6,6 +6,7 @@
 __metaclass__ = type
 
 from psycopg2.extensions import TRANSACTION_STATUS_IDLE
+import six
 from storm.zope.interfaces import IZStorm
 import transaction
 from zope.component import getUtility
@@ -34,7 +35,7 @@ class TestIsolation(TestCase):
         # transactions have been aborted.
         transaction.abort()
         for name, status in isolation.gen_store_statuses():
-            self.assertIsInstance(name, (str, unicode))
+            self.assertIsInstance(name, six.string_types)
             self.assertIn(status, (None, TRANSACTION_STATUS_IDLE))
         # At least one store will not be idle when a transaction has
         # begun.
diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
index 529dc7a..72bc1f0 100644
--- a/lib/lp/soyuz/model/archive.py
+++ b/lib/lp/soyuz/model/archive.py
@@ -639,7 +639,7 @@ class Archive(SQLBase):
                     SourcePackageName.id)
 
         if name is not None:
-            if type(name) in (str, unicode):
+            if isinstance(name, six.string_types):
                 if exact_match:
                     clauses.append(SourcePackageName.name == name)
                 else: