1
# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
1
# Copyright 2010 Canonical Ltd. This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
4
"""`TranslationTemplatesBuild` class."""
117
117
"""See `ITranslationTemplatesBuildSource`."""
118
118
store = cls._getStore(store)
120
def eager_load(rows):
121
# Load the related branches, products.
122
branches = load_related(
123
Branch, rows, ['branch_id'])
125
Product, branches, ['productID'])
126
# Preload branches cached associated product series and
127
# suite source packages for all the related branches.
128
GenericBranchCollection.preloadDataForBranches(branches)
130
120
resultset = store.find(
131
121
TranslationTemplatesBuild,
132
122
TranslationTemplatesBuild.build_farm_job_id.is_in(
133
123
buildfarmjob_ids))
134
return DecoratedResultSet(resultset, pre_iter_hook=eager_load)
124
return DecoratedResultSet(
125
resultset, pre_iter_hook=cls.preloadBuildsData)
128
def preloadBuildsData(cls, builds):
130
from lp.services.librarian.model import LibraryFileAlias
131
# Load the related branches, products.
132
branches = load_related(
133
Branch, builds, ['branch_id'])
135
Product, branches, ['productID'])
136
# Preload branches cached associated product series and
137
# suite source packages for all the related branches.
138
GenericBranchCollection.preloadDataForBranches(branches)
140
build.build_farm_job for build in builds]
141
load_related(LibraryFileAlias, build_farm_jobs, ['log_id'])
137
144
def findByBranch(cls, branch, store=None):