launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00505
[Merge] lp:~lifeless/launchpad/registry-packagings into lp:launchpad/devel
Robert Collins has proposed merging lp:~lifeless/launchpad/registry-packagings into lp:launchpad/devel.
Requested reviews:
Julian Edwards (julian-edwards): release-manager
Launchpad code reviewers (launchpad-reviewers)
Help address a high frequency timeout, bug 612358.
This probably is RC, as IIRC its an edge specific issue at the moment.
--
https://code.launchpad.net/~lifeless/launchpad/registry-packagings/+merge/32164
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/registry-packagings into lp:launchpad/devel.
=== modified file 'lib/lp/registry/browser/distroseries.py'
--- lib/lp/registry/browser/distroseries.py 2010-08-06 12:49:27 +0000
+++ lib/lp/registry/browser/distroseries.py 2010-08-10 03:04:46 +0000
@@ -317,7 +317,7 @@
@cachedproperty
def num_linked_packages(self):
"""The number of linked packagings for this distroseries."""
- return len(self.context.packagings)
+ return self.context.packagings.count()
@property
def num_unlinked_packages(self):
=== modified file 'lib/lp/registry/doc/distroseries.txt'
--- lib/lp/registry/doc/distroseries.txt 2010-07-28 02:02:25 +0000
+++ lib/lp/registry/doc/distroseries.txt 2010-08-10 03:04:46 +0000
@@ -479,7 +479,7 @@
>>> distribution = factory.makeDistribution()
>>> distroseries = factory.makeDistroRelease(distribution=distribution)
>>> pkgs = distroseries.getMostRecentlyLinkedPackagings()
- >>> print len(pkgs)
+ >>> print pkgs.count()
0
>>> for name in ['aaron', 'bjorn', 'chex', 'deryck', 'edwin', 'francis']:
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-08-02 02:13:52 +0000
+++ lib/lp/registry/model/distroseries.py 2010-08-10 03:04:46 +0000
@@ -286,10 +286,20 @@
@cachedproperty
def _all_packagings(self):
- """Get an unordered list of all packagings."""
+ """Get an unordered list of all packagings.
+
+ :return: A ResultSet which can be decorated or tuned further. Use
+ DistroSeries._packaging_row_to_packaging to extract the
+ packaging objects out.
+ """
# We join to SourcePackageName, ProductSeries, and Product to cache
# the objects that are implicitly needed to work with a
# Packaging object.
+ # NB: precaching objects like this method tries to do has a very poor
+ # hit rate with storm - many queries will still be executed; consider
+ # ripping this out and instead allowing explicit inclusion of things
+ # like Person._all_members does - returning a cached object graph.
+ # -- RBC 20100810
# Avoid circular import failures.
from lp.registry.model.product import Product
from lp.registry.model.productseries import ProductSeries
@@ -309,14 +319,19 @@
results = IStore(self).using(*origin).find(find_spec, condition)
return results
+ @staticmethod
+ def _packaging_row_to_packaging(row):
+ # each row has:
+ # (packaging, spn, product_series, product)
+ return row[0]
+
@property
def packagings(self):
"""See `IDistroSeries`."""
results = self._all_packagings
results = results.order_by(SourcePackageName.name)
- return [
- packaging
- for (packaging, spn, product_series, product) in results]
+ return DecoratedResultSet(results,
+ DistroSeries._packaging_row_to_packaging)
def getPrioritizedUnlinkedSourcePackages(self):
"""See `IDistroSeries`.
@@ -454,9 +469,8 @@
# identical creation dates.
results = results.order_by(Desc(Packaging.datecreated),
SourcePackageName.name)[:5]
- return [
- packaging
- for (packaging, spn, product_series, product) in results]
+ return DecoratedResultSet(results,
+ DistroSeries._packaging_row_to_packaging)
@property
def supported(self):