← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-bugs-remove-ensure-unicode into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-bugs-remove-ensure-unicode into launchpad:master.

Commit message:
Remove uses of ensure_unicode from lp.bugs

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/399021
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-bugs-remove-ensure-unicode into launchpad:master.
diff --git a/lib/lp/bugs/model/bugwatch.py b/lib/lp/bugs/model/bugwatch.py
index 1cc3a16..4d2ee48 100644
--- a/lib/lp/bugs/model/bugwatch.py
+++ b/lib/lp/bugs/model/bugwatch.py
@@ -70,10 +70,7 @@ from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.database.stormbase import StormBase
-from lp.services.helpers import (
-    ensure_unicode,
-    shortlist,
-    )
+from lp.services.helpers import shortlist
 from lp.services.messages.model.message import Message
 from lp.services.webapp import (
     urlappend,
@@ -770,7 +767,8 @@ class BugWatchSet:
         bulk.create(
             (BugWatchActivity.bug_watch_id, BugWatchActivity.result,
              BugWatchActivity.oops_id),
-            [(bug_watch_id, result, ensure_unicode(oops_id))
+            [(bug_watch_id, result,
+              None if oops_id is None else six.ensure_text(oops_id))
              for bug_watch_id in set(get_bug_watch_ids(references))])
 
 
diff --git a/lib/lp/bugs/tests/test_bugtracker_vocabulary.py b/lib/lp/bugs/tests/test_bugtracker_vocabulary.py
index 883f0ce..e766cd0 100644
--- a/lib/lp/bugs/tests/test_bugtracker_vocabulary.py
+++ b/lib/lp/bugs/tests/test_bugtracker_vocabulary.py
@@ -3,6 +3,8 @@
 
 """Test the bug tracker vocabularies."""
 
+from __future__ import absolute_import, print_function, unicode_literals
+
 __metaclass__ = type
 
 from zope.schema.vocabulary import getVocabularyRegistry
diff --git a/lib/lp/bugs/vocabularies.py b/lib/lp/bugs/vocabularies.py
index 34e4d98..7863a3b 100644
--- a/lib/lp/bugs/vocabularies.py
+++ b/lib/lp/bugs/vocabularies.py
@@ -65,10 +65,7 @@ from lp.registry.model.milestone import milestone_sort_key
 from lp.registry.model.productseries import ProductSeries
 from lp.registry.vocabularies import DistributionVocabulary
 from lp.services.database.interfaces import IStore
-from lp.services.helpers import (
-    ensure_unicode,
-    shortlist,
-    )
+from lp.services.helpers import shortlist
 from lp.services.webapp.escaping import (
     html_escape,
     structured,
@@ -138,7 +135,7 @@ class BugTrackerVocabulary(SQLObjectVocabularyBase):
 
     def search(self, query, vocab_filter=None):
         """Search for web bug trackers."""
-        query = ensure_unicode(query).lower()
+        query = query.lower()
         results = IStore(self._table).find(
             self._table, And(
             self._filter,