← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Rename IAnnouncement.project to IAnnouncement.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/announcement-projectgroup/+merge/247976

Rename IAnnouncement.project to IAnnouncement.projectgroup.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/announcement-projectgroup into lp:launchpad.
=== modified file 'lib/lp/registry/doc/announcement.txt'
--- lib/lp/registry/doc/announcement.txt	2011-12-30 06:14:56 +0000
+++ lib/lp/registry/doc/announcement.txt	2015-01-29 12:50:27 +0000
@@ -145,8 +145,8 @@
 announcements. The listings can either include unpublished items, or just be
 of published items that are visible to everyone.
 
-Note that products that are part of a project will show all the project
-announcements, and vice versa.
+Note that products that are part of a project group will show all the
+project group announcements, and vice versa.
 
     >>> import transaction
     >>> transaction.commit()

=== modified file 'lib/lp/registry/interfaces/announcement.py'
--- lib/lp/registry/interfaces/announcement.py	2010-08-20 20:31:18 +0000
+++ lib/lp/registry/interfaces/announcement.py	2015-01-29 12:50:27 +0000
@@ -67,7 +67,7 @@
     # The potential pillars to which the Announcement could belong, of which
     # only 1 should not be None.
     product = Attribute("The product for this announcement.")
-    project = Attribute("The project for this announcement.")
+    projectgroup = Attribute("The project group for this announcement.")
     distribution = Attribute("The distribution for this announcement.")
 
     target = Attribute("The pillar to which this announcement belongs.")
@@ -115,5 +115,3 @@
 
     displayname = Attribute("Launchpad")
     title = Attribute("Launchpad title")
-
-

=== modified file 'lib/lp/registry/model/announcement.py'
--- lib/lp/registry/model/announcement.py	2012-04-16 23:02:44 +0000
+++ lib/lp/registry/model/announcement.py	2015-01-29 12:50:27 +0000
@@ -38,7 +38,7 @@
 
 class Announcement(SQLBase):
     """A news item. These allow us to generate lists of recent news for
-    projects, products and distributions.
+    project groups, products and distributions.
     """
     implements(IAnnouncement)
 
@@ -53,7 +53,7 @@
         dbName='registrant', foreignKey='Person',
         storm_validator=validate_public_person, notNull=True)
     product = ForeignKey(dbName='product', foreignKey='Product')
-    project = ForeignKey(dbName='project', foreignKey='ProjectGroup')
+    projectgroup = ForeignKey(dbName='project', foreignKey='ProjectGroup')
     distribution = ForeignKey(
         dbName='distribution', foreignKey='Distribution')
     title = StringCol(notNull=True)
@@ -76,12 +76,12 @@
     def target(self):
         if self.product is not None:
             return self.product
-        elif self.project is not None:
-            return self.project
+        elif self.projectgroup is not None:
+            return self.projectgroup
         elif self.distribution is not None:
             return self.distribution
         else:
-            raise AssertionError, 'Announcement has no obvious target'
+            raise AssertionError('Announcement has no obvious target')
 
     @property
     def date_updated(self):
@@ -94,17 +94,17 @@
         if IProduct.providedBy(target):
             self.product = target
             self.distribution = None
-            self.project = None
+            self.projectgroup = None
         elif IDistribution.providedBy(target):
             self.distribution = target
-            self.project = None
+            self.projectgroup = None
             self.product = None
         elif IProjectGroup.providedBy(target):
-            self.project = target
+            self.projectgroup = target
             self.distribution = None
             self.product = None
         else:
-            raise AssertionError, 'Unknown target'
+            raise AssertionError('Unknown target')
         self.date_last_modified = UTC_NOW
 
     def retract(self):
@@ -172,7 +172,7 @@
             query += """ AND
                 (Announcement.project = %s OR Announcement.product IN
                     (SELECT id FROM Product WHERE project = %s))
-                    """ % sqlvalues (self.id, self.id)
+                    """ % sqlvalues(self.id, self.id)
         elif IDistribution.providedBy(self):
             query += (' AND Announcement.distribution = %s'
                 % sqlvalues(self.id))
@@ -181,7 +181,7 @@
             # all announcements.
             pass
         else:
-            raise AssertionError, 'Unsupported announcement target'
+            raise AssertionError('Unsupported announcement target')
         return Announcement.select(query, limit=limit)
 
 
@@ -192,25 +192,25 @@
         """See IHasAnnouncements."""
 
         # We establish the appropriate target property.
-        project = product = distribution = None
+        projectgroup = product = distribution = None
         if IProduct.providedBy(self):
             product = self
         elif IProjectGroup.providedBy(self):
-            project = self
+            projectgroup = self
         elif IDistribution.providedBy(self):
             distribution = self
         else:
-            raise AssertionError, 'Unsupported announcement target'
+            raise AssertionError('Unsupported announcement target')
 
         # Create the announcement in the database.
         announcement = Announcement(
-            registrant = user,
-            title = title,
-            summary = summary,
-            url = url,
-            product = product,
-            project = project,
-            distribution = distribution
+            registrant=user,
+            title=title,
+            summary=summary,
+            url=url,
+            product=product,
+            projectgroup=projectgroup,
+            distribution=distribution,
             )
 
         announcement.setPublicationDate(publication_date)
@@ -224,6 +224,3 @@
 
     displayname = 'Launchpad-hosted'
     title = 'Launchpad'
-
-
-


Follow ups