Part of canonical.launchpad.components.decoratedresultset View In Hierarchy
Because DistroSeriesBinaryPackage doesn't actually exist in the
database, the DistroSeries.searchPackages method uses the
DistroSeriesPackageCache object to search for packages within a
DistroSeries.
Nonetheless, the users of the searchPackages method (such as the
DistroSeriesView) expect a result set of DSBPs. Rather than executing
the query prematurely and doing a list comprehension on the complete
result set (which could be very large) to convert all the results (even
though batching may mean only a window of 10 results is required), this
adapted result set converts the results only when they are needed.
This behaviour is required for other classes as well (Distribution, DistroArchSeries), hence a generalised solution.
| Method | __init__ | |
| Method | decorate_or_none | Decorate a result or return None if the result is itself None |
| Method | copy | See IResultSet. |
| Method | config | See IResultSet. |
| Method | __iter__ | See IResultSet. |
| Method | __getitem__ | See IResultSet. |
| Method | any | See IResultSet. |
| Method | first | See IResultSet. |
| Method | last | See IResultSet. |
| Method | one | See IResultSet. |
| Method | order_by | See IResultSet. |
| Parameters | result_set | The original result set to be decorated. |
| result_decorator | The method with which individual results will be passed through before being returned. | |
| pre_iter_hook | The method to be called (with the 'result_set') immediately before iteration starts. | |
| slice_info | If True pass information about the slice parameters to the result_decorator and pre_iter_hook. any() and similar methods will cause None to be supplied. |
IResultSet.| Returns | The decorated version of the returned result set. | |
IResultSet.| Returns | The decorated result set.after updating the config. | |
IResultSet.
Yield a decorated version of the returned value.
IResultSet.| Returns | The decorated version of the returned value. | |