← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/faqsearch-projectgroup into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/faqsearch-projectgroup into lp:launchpad.

Commit message:
Rename FAQSearch.project to FAQSearch.projectgroup.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #523054 in Launchpad itself: "Rename Product.project to Product.projectgroup"
  https://bugs.launchpad.net/launchpad/+bug/523054

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/faqsearch-projectgroup/+merge/247968

Rename FAQSearch.project to FAQSearch.projectgroup.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/faqsearch-projectgroup into lp:launchpad.
=== modified file 'lib/lp/answers/model/faq.py'
--- lib/lp/answers/model/faq.py	2013-07-12 06:14:22 +0000
+++ lib/lp/answers/model/faq.py	2015-01-29 11:38:38 +0000
@@ -169,17 +169,17 @@
     sort = None
     product = None
     distribution = None
-    project = None
+    projectgroup = None
 
     def __init__(self, search_text=None, owner=None, sort=None, product=None,
-                 distribution=None, project=None):
+                 distribution=None, projectgroup=None):
         """Initialize a new FAQ search.
 
         See `IFAQCollection`.searchFAQs for the basic parameters description.
         Additional parameters:
         :param product: The product in which to search for FAQs.
         :param distribution: The distribution in which to search for FAQs.
-        :param project: The project in which to search for FAQs.
+        :param projectgroup: The project group in which to search for FAQs.
         """
         if search_text is not None:
             assert isinstance(search_text, basestring), (
@@ -199,24 +199,25 @@
         if product is not None:
             assert IProduct.providedBy(product), (
                 'product should be an IProduct, not %s' % type(product))
-            assert distribution is None and project is None, (
-                'can only use one of product, distribution, or project')
+            assert distribution is None and projectgroup is None, (
+                'can only use one of product, distribution, or projectgroup')
             self.product = product
 
         if distribution is not None:
             assert IDistribution.providedBy(distribution), (
                 'distribution should be an IDistribution, %s' %
                 type(distribution))
-            assert product is None and project is None, (
-                'can only use one of product, distribution, or project')
+            assert product is None and projectgroup is None, (
+                'can only use one of product, distribution, or projectgroup')
             self.distribution = distribution
 
-        if project is not None:
-            assert IProjectGroup.providedBy(project), (
-                'project should be an IProjectGroup, not %s' % type(project))
+        if projectgroup is not None:
+            assert IProjectGroup.providedBy(projectgroup), (
+                'projectgroup should be an IProjectGroup, not %s' %
+                type(projectgroup))
             assert product is None and distribution is None, (
-                'can only use one of product, distribution, or project')
-            self.project = project
+                'can only use one of product, distribution, or projectgroup')
+            self.projectgroup = projectgroup
 
     def getResults(self):
         """Return the FAQs matching this search."""
@@ -242,16 +243,16 @@
             constraints.append(
                 'FAQ.distribution = %s' % sqlvalues(self.distribution))
 
-        if self.project:
+        if self.projectgroup:
             constraints.append(
                 'FAQ.product = Product.id AND Product.project = %s' % (
-                    sqlvalues(self.project)))
+                    sqlvalues(self.projectgroup)))
 
         return '\n AND '.join(constraints)
 
     def getClauseTables(self):
         """Return the tables that should be added to the FROM clause."""
-        if self.project:
+        if self.projectgroup:
             return ['Product']
         else:
             return []

=== modified file 'lib/lp/registry/model/projectgroup.py'
--- lib/lp/registry/model/projectgroup.py	2015-01-29 08:50:38 +0000
+++ lib/lp/registry/model/projectgroup.py	2015-01-29 11:38:38 +0000
@@ -336,7 +336,7 @@
         """See `IQuestionCollection`."""
         return FAQSearch(
             search_text=search_text, owner=owner, sort=sort,
-            project=self).getResults()
+            projectgroup=self).getResults()
 
     def hasProducts(self):
         """Returns True if a project has products associated with it, False


Follow ups