launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17814
[Merge] lp:~cjwatson/launchpad/simplify-branchcollection into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/simplify-branchcollection into lp:launchpad.
Commit message:
Remove unused exclude_from_search facility from BranchCollection and BranchMergeQueueCollection.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/simplify-branchcollection/+merge/248752
Remove unused exclude_from_search facility from BranchCollection and BranchMergeQueueCollection. It hasn't been used since bug 793830 was fixed in r16492.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/simplify-branchcollection into lp:launchpad.
=== modified file 'lib/lp/code/model/branchcollection.py'
--- lib/lp/code/model/branchcollection.py 2015-01-29 16:28:30 +0000
+++ lib/lp/code/model/branchcollection.py 2015-02-05 13:12:17 +0000
@@ -84,7 +84,7 @@
implements(IBranchCollection)
def __init__(self, store=None, branch_filter_expressions=None,
- tables=None, exclude_from_search=None,
+ tables=None,
asymmetric_filter_expressions=None, asymmetric_tables=None):
"""Construct a `GenericBranchCollection`.
@@ -116,9 +116,6 @@
if asymmetric_tables is None:
asymmetric_tables = {}
self._asymmetric_tables = asymmetric_tables
- if exclude_from_search is None:
- exclude_from_search = []
- self._exclude_from_search = exclude_from_search
self._user = None
def count(self):
@@ -150,8 +147,7 @@
else:
return self._store
- def _filterBy(self, expressions, table=None, join=None,
- exclude_from_search=None, symmetric=True):
+ def _filterBy(self, expressions, table=None, join=None, symmetric=True):
"""Return a subset of this collection, filtered by 'expressions'.
:param symmetric: If True this filter will apply to both sides
@@ -179,13 +175,10 @@
symmetric_expr = list(self._branch_filter_expressions)
asymmetric_expr = (
self._asymmetric_filter_expressions + expressions)
- if exclude_from_search is None:
- exclude_from_search = []
return self.__class__(
self.store,
symmetric_expr,
tables,
- self._exclude_from_search + exclude_from_search,
asymmetric_expr,
asymmetric_tables)
@@ -537,8 +530,7 @@
def inProduct(self, product):
"""See `IBranchCollection`."""
- return self._filterBy(
- [Branch.product == product], exclude_from_search=['product'])
+ return self._filterBy([Branch.product == product])
def inProjectGroup(self, projectgroup):
"""See `IBranchCollection`."""
@@ -697,12 +689,10 @@
return self
if person is None:
return AnonymousBranchCollection(
- self._store, self._branch_filter_expressions,
- self._tables, self._exclude_from_search,
+ self._store, self._branch_filter_expressions, self._tables,
self._asymmetric_filter_expressions, self._asymmetric_tables)
return VisibleBranchCollection(
- person, self._store, self._branch_filter_expressions,
- self._tables, self._exclude_from_search,
+ person, self._store, self._branch_filter_expressions, self._tables,
self._asymmetric_filter_expressions, self._asymmetric_tables)
def withBranchType(self, *branch_types):
@@ -740,17 +730,16 @@
"""A branch collection that has special logic for visibility."""
def __init__(self, user, store=None, branch_filter_expressions=None,
- tables=None, exclude_from_search=None,
+ tables=None,
asymmetric_filter_expressions=None, asymmetric_tables=None):
super(VisibleBranchCollection, self).__init__(
store=store, branch_filter_expressions=branch_filter_expressions,
- tables=tables, exclude_from_search=exclude_from_search,
+ tables=tables,
asymmetric_filter_expressions=asymmetric_filter_expressions,
asymmetric_tables=asymmetric_tables)
self._user = user
- def _filterBy(self, expressions, table=None, join=None,
- exclude_from_search=None, symmetric=True):
+ def _filterBy(self, expressions, table=None, join=None, symmetric=True):
"""Return a subset of this collection, filtered by 'expressions'.
:param symmetric: If True this filter will apply to both sides
@@ -778,11 +767,8 @@
symmetric_expr = list(self._branch_filter_expressions)
asymmetric_expr = (
self._asymmetric_filter_expressions + expressions)
- if exclude_from_search is None:
- exclude_from_search = []
return self.__class__(
self._user, self.store, symmetric_expr, tables,
- self._exclude_from_search + exclude_from_search,
asymmetric_expr, asymmetric_tables)
def _getBranchVisibilityExpression(self, branch_class=Branch):
=== modified file 'lib/lp/code/model/branchmergequeuecollection.py'
--- lib/lp/code/model/branchmergequeuecollection.py 2013-06-20 05:50:00 +0000
+++ lib/lp/code/model/branchmergequeuecollection.py 2015-02-05 13:12:17 +0000
@@ -28,7 +28,7 @@
implements(IBranchMergeQueueCollection)
def __init__(self, store=None, merge_queue_filter_expressions=None,
- tables=None, exclude_from_search=None):
+ tables=None):
"""Construct a `GenericBranchMergeQueueCollection`.
:param store: The store to look in for merge queues. If not specified,
@@ -48,9 +48,6 @@
if tables is None:
tables = {}
self._tables = tables
- if exclude_from_search is None:
- exclude_from_search = []
- self._exclude_from_search = exclude_from_search
def count(self):
return self._getCount()
@@ -66,23 +63,19 @@
else:
return self._store
- def _filterBy(self, expressions, table=None, join=None,
- exclude_from_search=None):
+ def _filterBy(self, expressions, table=None, join=None):
"""Return a subset of this collection, filtered by 'expressions'."""
tables = self._tables.copy()
if table is not None:
if join is None:
raise InvalidFilter("Cannot specify a table without a join.")
tables[table] = join
- if exclude_from_search is None:
- exclude_from_search = []
if expressions is None:
expressions = []
return self.__class__(
self.store,
self._merge_queue_filter_expressions + expressions,
- tables,
- self._exclude_from_search + exclude_from_search)
+ tables)
def _getMergeQueueExpressions(self):
"""Return the where expressions for this collection."""
@@ -107,43 +100,34 @@
user_has_special_merge_queue_access(person)):
return self
return VisibleBranchMergeQueueCollection(
- person,
- self._store, None,
- self._tables, self._exclude_from_search)
+ person, self._store, None, self._tables)
class VisibleBranchMergeQueueCollection(GenericBranchMergeQueueCollection):
"""A mergequeue collection which provides queues visible by a user."""
def __init__(self, person, store=None,
- merge_queue_filter_expressions=None, tables=None,
- exclude_from_search=None):
+ merge_queue_filter_expressions=None, tables=None):
super(VisibleBranchMergeQueueCollection, self).__init__(
store=store,
merge_queue_filter_expressions=merge_queue_filter_expressions,
- tables=tables,
- exclude_from_search=exclude_from_search,
- )
+ tables=tables)
self._user = person
- def _filterBy(self, expressions, table=None, join=None,
- exclude_from_search=None):
+ def _filterBy(self, expressions, table=None, join=None):
"""Return a subset of this collection, filtered by 'expressions'."""
tables = self._tables.copy()
if table is not None:
if join is None:
raise InvalidFilter("Cannot specify a table without a join.")
tables[table] = join
- if exclude_from_search is None:
- exclude_from_search = []
if expressions is None:
expressions = []
return self.__class__(
self._user,
self.store,
self._merge_queue_filter_expressions + expressions,
- tables,
- self._exclude_from_search + exclude_from_search)
+ tables)
def visibleByUser(self, person):
"""See `IBranchMergeQueueCollection`."""
Follow ups