← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-code-collection-values into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-code-collection-values into launchpad:master.

Commit message:
Adjust Generic{Branch,Git}Collection for Python 3 dict.values

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

We can't concatenate the results of two dict.values() calls any more.  Coercing to list first would work, but set union makes more sense in context.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-code-collection-values into launchpad:master.
diff --git a/lib/lp/code/model/branchcollection.py b/lib/lp/code/model/branchcollection.py
index 4ae6624..f07416a 100644
--- a/lib/lp/code/model/branchcollection.py
+++ b/lib/lp/code/model/branchcollection.py
@@ -317,8 +317,8 @@ class GenericBranchCollection:
 
     def getBranches(self, find_expr=Branch, eager_load=False, sort_by=None):
         """See `IBranchCollection`."""
-        all_tables = set(
-            self._tables.values() + self._asymmetric_tables.values())
+        all_tables = (
+            set(self._tables.values()) | set(self._asymmetric_tables.values()))
         tables = [Branch] + list(all_tables)
         expressions = self._getBranchExpressions()
         resultset = self.store.using(*tables).find(find_expr, *expressions)
@@ -385,8 +385,8 @@ class GenericBranchCollection:
                                 merged_revnos=None, merged_revision=None,
                                 eager_load=False):
         Target = ClassAlias(Branch, "target")
-        extra_tables = list(set(
-            self._tables.values() + self._asymmetric_tables.values()))
+        extra_tables = list(
+            set(self._tables.values()) | set(self._asymmetric_tables.values()))
         tables = [Branch] + extra_tables + [
             Join(BranchMergeProposal, And(
                 Branch.id == BranchMergeProposal.source_branchID,
diff --git a/lib/lp/code/model/gitcollection.py b/lib/lp/code/model/gitcollection.py
index 6fa99be..eef06f6 100644
--- a/lib/lp/code/model/gitcollection.py
+++ b/lib/lp/code/model/gitcollection.py
@@ -244,8 +244,8 @@ class GenericGitCollection:
     def getRepositories(self, find_expr=GitRepository, eager_load=False,
                         sort_by=None):
         """See `IGitCollection`."""
-        all_tables = set(
-            self._tables.values() + self._asymmetric_tables.values())
+        all_tables = (
+            set(self._tables.values()) | set(self._asymmetric_tables.values()))
         tables = [GitRepository] + list(all_tables)
         expressions = self._getRepositoryExpressions()
         resultset = (
@@ -311,8 +311,8 @@ class GenericGitCollection:
                                 merged_revision_ids=None,
                                 merge_proposal_ids=None, eager_load=False):
         Target = ClassAlias(GitRepository, "target")
-        extra_tables = list(set(
-            self._tables.values() + self._asymmetric_tables.values()))
+        extra_tables = list(
+            set(self._tables.values()) | set(self._asymmetric_tables.values()))
         tables = [GitRepository] + extra_tables + [
             Join(BranchMergeProposal, And(
                 GitRepository.id ==