launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26186
[Merge] ~cjwatson/launchpad:py3-avoid-unicode into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-avoid-unicode into launchpad:master.
Commit message:
Avoid remaining uses of the Python 2 "unicode" type
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397324
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-avoid-unicode into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index 76553b3..d48224a 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -3398,7 +3398,7 @@ class TestPublisherLite(TestCaseWithFactory):
purposes, the fake object will compare equal to a string holding
this same text, encoded in the requested encoding.
"""
- class FakeReleaseData(unicode):
+ class FakeReleaseData(six.text_type):
def dump(self, output_file, encoding):
output_file.write(self.encode(encoding))
diff --git a/lib/lp/archiveuploader/utils.py b/lib/lp/archiveuploader/utils.py
index 4168d96..334a2aa 100644
--- a/lib/lp/archiveuploader/utils.py
+++ b/lib/lp/archiveuploader/utils.py
@@ -210,10 +210,10 @@ def parse_maintainer(maintainer, field_name="Maintainer"):
def parse_maintainer_bytes(content, fieldname):
"""Wrapper for parse_maintainer to handle both Unicode and bytestrings.
- It verifies the content type and transforms it to a unicode with
+ It verifies the content type and transforms it to text with
guess(). Then we can safely call parse_maintainer().
"""
- if type(content) != unicode:
+ if not isinstance(content, six.text_type):
content = guess_encoding(content)
return parse_maintainer(content, fieldname)
diff --git a/lib/lp/registry/browser/tests/test_person.py b/lib/lp/registry/browser/tests/test_person.py
index 551dea7..68222c4 100644
--- a/lib/lp/registry/browser/tests/test_person.py
+++ b/lib/lp/registry/browser/tests/test_person.py
@@ -740,7 +740,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
"""Special assert function for dealing with email-related errors."""
view = self.createAddEmailView(email_str)
error_msg = view.errors[0]
- if type(error_msg) != unicode:
+ if not isinstance(error_msg, six.text_type):
error_msg = error_msg.doc()
self.assertEqual(expected_msg, error_msg)