← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bryce/launchpad/cronjob-component-deletion into lp:launchpad

 

Bryce Harrington has proposed merging lp:~bryce/launchpad/cronjob-component-deletion into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~bryce/launchpad/cronjob-component-deletion/+merge/67782

Fix logic to drop old components when they've been dropped upstream.

Also, add pydocs to all the cronscripts functions.
-- 
https://code.launchpad.net/~bryce/launchpad/cronjob-component-deletion/+merge/67782
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bryce/launchpad/cronjob-component-deletion into lp:launchpad.
=== modified file 'lib/lp/bugs/scripts/bzremotecomponentfinder.py'
--- lib/lp/bugs/scripts/bzremotecomponentfinder.py	2011-07-01 18:36:56 +0000
+++ lib/lp/bugs/scripts/bzremotecomponentfinder.py	2011-07-13 02:43:26 +0000
@@ -51,9 +51,11 @@
         self.products = {}
 
     def getPage(self):
+        """Downloads and returns content from the Bugzilla page"""
         return urlopen(self.url).read()
 
     def parsePage(self, page_text):
+        """Builds self.product using HTML content in page_text"""
         soup = BeautifulSoup(page_text)
         if soup is None:
             return None
@@ -118,6 +120,7 @@
         self.static_bugzilla_scraper = static_bugzilla_scraper
 
     def getRemoteProductsAndComponents(self, bugtracker_name=None):
+        """Retrieves, parses, and stores component data for each bugtracker"""
         lp_bugtrackers = getUtility(IBugTrackerSet)
         if bugtracker_name is not None:
             lp_bugtrackers = [
@@ -162,6 +165,7 @@
                 bz_bugtracker, lp_bugtracker)
 
     def storeRemoteProductsAndComponents(self, bz_bugtracker, lp_bugtracker):
+        """Stores parsed product/component data from bz_bugtracker"""
         components_to_add = []
         for product in bz_bugtracker.products.itervalues():
             # Look up the component group id from Launchpad for the product
@@ -185,7 +189,11 @@
                     else:
                         # Component is now missing from Bugzilla,
                         # so drop it here too
-                        component.remove()
+                        store = IStore(BugTrackerComponent)
+                        store.find(
+                            BugTrackerComponent,
+                            BugTrackerComponent.id == component.id,
+                            ).remove()
 
             # The remaining components in the collection will need to be
             # added to launchpad.  Record them for now.


Follow ups