← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:testfix-stormify-cve into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:testfix-stormify-cve into launchpad:master.

Commit message:
testfix: Pass Unicode to CveSet.__getitem__

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/389668
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:testfix-stormify-cve into launchpad:master.
diff --git a/lib/lp/bugs/mail/commands.py b/lib/lp/bugs/mail/commands.py
index 0bb2b97..651a062 100644
--- a/lib/lp/bugs/mail/commands.py
+++ b/lib/lp/bugs/mail/commands.py
@@ -17,6 +17,7 @@ from lazr.lifecycle.interfaces import (
     IObjectModifiedEvent,
     )
 from lazr.lifecycle.snapshot import Snapshot
+import six
 from zope.component import getUtility
 from zope.event import notify
 from zope.interface import (
@@ -452,7 +453,7 @@ class CVEEmailCommand(EmailCommand):
     def execute(self, bug, current_event):
         """See IEmailCommand."""
         [cve_sequence] = self.string_args
-        cve = getUtility(ICveSet)[cve_sequence]
+        cve = getUtility(ICveSet)[six.ensure_text(cve_sequence)]
         if cve is None:
             raise EmailProcessingError(
                 'Launchpad can\'t find the CVE "%s".' % cve_sequence)
diff --git a/lib/lp/bugs/scripts/bugimport.py b/lib/lp/bugs/scripts/bugimport.py
index 1d872de..da403e5 100644
--- a/lib/lp/bugs/scripts/bugimport.py
+++ b/lib/lp/bugs/scripts/bugimport.py
@@ -22,6 +22,7 @@ import time
 
 from defusedxml import cElementTree
 import pytz
+import six
 from six.moves import cPickle as pickle
 from storm.store import Store
 from zope.component import getUtility
@@ -86,8 +87,8 @@ def get_text(node):
         raise BugXMLSyntaxError('No child nodes are expected for <%s>'
                                 % node.tag)
     if node.text is None:
-        return ''
-    return node.text.strip()
+        return u''
+    return six.ensure_text(node.text.strip())
 
 
 def get_enum_value(enumtype, name):