~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/translations/model/translationtemplatesbuildjob.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-01 12:03:28 UTC
  • mfrom: (14612.3.1 feeds-stories)
  • Revision ID: launchpad@pqm.canonical.com-20120101120328-4nypd4mqnjzk62a7
[r=wgrant][no-qa] Move feeds stories from lp.services.session to
        lp.services.feeds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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).
3
3
 
4
4
__metaclass__ = type
36
36
    BranchJobType,
37
37
    )
38
38
from lp.services.config import config
39
 
from lp.services.database.bulk import load_related
40
39
from lp.services.database.lpstorm import (
41
40
    IMasterStore,
42
41
    IStore,
227
226
            return cls(branch_job)
228
227
 
229
228
    @classmethod
230
 
    def getByJobs(cls, jobs):
231
 
        """See `IBuildFarmJob`.
232
 
 
233
 
        Overridden here to search via a BranchJob, rather than a Job.
234
 
        """
235
 
        store = IStore(BranchJob)
236
 
        job_ids = [job.id for job in jobs]
237
 
        branch_jobs = store.find(
238
 
            BranchJob, BranchJob.jobID.is_in(job_ids))
239
 
        return [cls(branch_job) for branch_job in branch_jobs]
240
 
 
241
 
    @classmethod
242
 
    def preloadJobsData(cls, jobs):
243
 
        # Circular imports.
244
 
        from lp.code.model.branch import Branch
245
 
        from lp.registry.model.product import Product
246
 
        from lp.code.model.branchcollection import GenericBranchCollection
247
 
        from lp.services.job.model.job import Job
248
 
        contexts = [job.context for job in jobs]
249
 
        load_related(Job, contexts, ['jobID'])
250
 
        branches = load_related(Branch, contexts, ['branchID'])
251
 
        GenericBranchCollection.preloadDataForBranches(branches)
252
 
        load_related(Product, branches, ['productID'])
253
 
 
254
 
    @classmethod
255
229
    def getByBranch(cls, branch):
256
230
        """See `ITranslationTemplatesBuildJobSource`."""
257
231
        store = IStore(BranchJob)