← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/db-pre-747546 into lp:launchpad/db-devel

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/db-pre-747546 into lp:launchpad/db-devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers): code
Related bugs:
  Bug #747546 in Launchpad itself: "Derived Distros: Add a button to sync all packages changed in parent but not changed in child"
  https://bugs.launchpad.net/launchpad/+bug/747546

For more details, see:
https://code.launchpad.net/~jtv/launchpad/db-pre-747546/+merge/59737

Some lint I came across while working on bug 747546, which I want to be rid of but don't want polluting my review diff.
-- 
https://code.launchpad.net/~jtv/launchpad/db-pre-747546/+merge/59737
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/db-pre-747546 into lp:launchpad/db-devel.
=== modified file 'lib/canonical/launchpad/components/decoratedresultset.py'
--- lib/canonical/launchpad/components/decoratedresultset.py	2011-03-22 00:18:47 +0000
+++ lib/canonical/launchpad/components/decoratedresultset.py	2011-05-03 07:18:34 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # pylint: disable-msg=E0611,W0212
@@ -37,9 +37,14 @@
     def __init__(self, result_set, result_decorator=None, pre_iter_hook=None,
                  slice_info=False):
         """
+        Wrap `result_set` in a decorator.
+
+        The decorator will act as a result set where a result row `self[x]`
+        is really `result_decorator(result_set[x])`.
+
         :param result_set: The original result set to be decorated.
-        :param result_decorator: The method with which individual results
-            will be passed through before being returned.
+        :param result_decorator: A transformation function that individual
+            results will be passed through.
         :param pre_iter_hook: The method to be called (with the 'result_set')
             immediately before iteration starts. The return value of the hook
             is ignored.

=== modified file 'lib/canonical/launchpad/doc/decoratedresultset.txt'
--- lib/canonical/launchpad/doc/decoratedresultset.txt	2010-11-06 12:08:24 +0000
+++ lib/canonical/launchpad/doc/decoratedresultset.txt	2011-05-03 07:18:34 +0000
@@ -22,9 +22,9 @@
     >>> from lp.registry.model.distribution import Distribution
     >>> result_set = store.find(Distribution)
 
-== Creating the decorator method ==
+== Creating the decorator function ==
 
-We create a decorator method that we want to be applied to any
+We create a decorator function that we want to be applied to any
 results obtained from our undecorated result set. For instance,
 we can turn a model object into a string:
 
@@ -80,7 +80,7 @@
     >>> from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
     >>> from lp.soyuz.model.publishing import BinaryPackagePublishingHistory
     >>> results = store.find(BinaryPackageRelease,
-    ...     BinaryPackageRelease.id == 
+    ...     BinaryPackageRelease.id ==
     ...         BinaryPackagePublishingHistory.binarypackagereleaseID)
     >>> results = results.config(distinct=True)
     >>> len(list(results))

=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py	2011-04-22 00:58:35 +0000
+++ lib/lp/registry/model/distroseriesdifference.py	2011-05-03 07:18:34 +0000
@@ -277,29 +277,26 @@
             And(*conditions)).order_by(SourcePackageName.name)
 
         def eager_load(dsds):
+            active_statuses = (
+                PackagePublishingStatus.PUBLISHED,
+                PackagePublishingStatus.PENDING,
+                )
             source_pubs = dict(
                 most_recent_publications(
-                    dsds, in_parent=False, statuses=(
-                        PackagePublishingStatus.PUBLISHED,
-                        PackagePublishingStatus.PENDING)))
+                    dsds, statuses=active_statuses,
+                    in_parent=False, match_version=False))
             parent_source_pubs = dict(
                 most_recent_publications(
-                    dsds, in_parent=True, statuses=(
-                        PackagePublishingStatus.PUBLISHED,
-                        PackagePublishingStatus.PENDING)))
-
+                    dsds, statuses=active_statuses,
+                    in_parent=True, match_version=False))
             source_pubs_for_release = dict(
                 most_recent_publications(
-                    dsds, in_parent=False, statuses=(
-                        PackagePublishingStatus.PUBLISHED,
-                        PackagePublishingStatus.PENDING),
-                    match_version=True))
+                    dsds, statuses=active_statuses,
+                    in_parent=False, match_version=True))
             parent_source_pubs_for_release = dict(
                 most_recent_publications(
-                    dsds, in_parent=True, statuses=(
-                        PackagePublishingStatus.PUBLISHED,
-                        PackagePublishingStatus.PENDING),
-                    match_version=True))
+                    dsds, statuses=active_statuses,
+                    in_parent=True, match_version=True))
 
             latest_comment_by_dsd_id = dict(
                 (comment.distro_series_difference_id, comment)