119
119
"""See `ITranslationTemplatesBuildSource`."""
120
120
store = cls._getStore(store)
122
def eager_load(rows):
123
# Load the related branches, products.
124
branches = load_related(
125
Branch, rows, ['branch_id'])
127
Product, branches, ['productID'])
128
# Preload branches cached associated product series and
129
# suite source packages for all the related branches.
130
GenericBranchCollection.preloadDataForBranches(branches)
132
122
resultset = store.find(
133
123
TranslationTemplatesBuild,
134
124
TranslationTemplatesBuild.build_farm_job_id.is_in(
135
125
buildfarmjob_ids))
136
return DecoratedResultSet(resultset, pre_iter_hook=eager_load)
126
return DecoratedResultSet(
127
resultset, pre_iter_hook=cls.preloadBuildsData)
130
def preloadBuildsData(cls, builds):
132
from canonical.launchpad.database.librarian import LibraryFileAlias
133
# Load the related branches, products.
134
branches = load_related(
135
Branch, builds, ['branch_id'])
137
Product, branches, ['productID'])
138
# Preload branches cached associated product series and
139
# suite source packages for all the related branches.
140
GenericBranchCollection.preloadDataForBranches(branches)
142
build.build_farm_job for build in builds]
143
load_related(LibraryFileAlias, build_farm_jobs, ['log_id'])
139
146
def findByBranch(cls, branch, store=None):