← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-stormify-sourcepackagename into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-stormify-sourcepackagename into launchpad:master.

Commit message:
Use "!=" rather than "is not" to compare question targets

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/450384

Storm objects referring to the same row aren't necessarily identical objects, and converting `SourcePackageName` to Storm managed to trigger this.  Use normal inequality tests instead.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-stormify-sourcepackagename into launchpad:master.
diff --git a/lib/lp/answers/model/question.py b/lib/lp/answers/model/question.py
index a561d0f..af02476 100644
--- a/lib/lp/answers/model/question.py
+++ b/lib/lp/answers/model/question.py
@@ -1604,7 +1604,7 @@ class QuestionTargetMixin:
 
     def questionIsForTarget(self, question):
         """Verify that this question is actually for this target."""
-        if question.target is not self:
+        if question.target != self:
             return False
         return True
 
diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
index 8abb04f..3e4367f 100644
--- a/lib/lp/registry/model/distribution.py
+++ b/lib/lp/registry/model/distribution.py
@@ -1464,7 +1464,7 @@ class Distribution(
 
         Return True when the Question's distribution is self.
         """
-        if question.distribution is not self:
+        if question.distribution != self:
             return False
         return True
 
diff --git a/lib/lp/registry/model/sourcepackage.py b/lib/lp/registry/model/sourcepackage.py
index c15b371..2dc7aff 100644
--- a/lib/lp/registry/model/sourcepackage.py
+++ b/lib/lp/registry/model/sourcepackage.py
@@ -91,9 +91,9 @@ class SourcePackageQuestionTargetMixin(QuestionTargetMixin):
         Return True when the question's distribution and sourcepackagename
         are this object's distribution and sourcepackagename.
         """
-        if question.distribution is not self.distribution:
+        if question.distribution != self.distribution:
             return False
-        if question.sourcepackagename is not self.sourcepackagename:
+        if question.sourcepackagename != self.sourcepackagename:
             return False
         return True