~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-22 04:45:35 UTC
  • mfrom: (14565.2.24 apocalyptic-pieces)
  • Revision ID: launchpad@pqm.canonical.com-20111222044535-jbjyzq3hzwiy7g20
[rs=sinzui][no-qa] Move javascript and scripts to lp. Dismantle
 mailnotification.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from lp.services.job.model.job import Job
35
35
from lp.services.job.runner import BaseRunnableJob
36
36
from lp.translations.interfaces.pofilestatsjob import IPOFileStatsJobSource
37
 
from lp.translations.interfaces.potemplate import IPOTemplateSet
38
37
from lp.translations.model.pofile import POFile
39
38
 
40
39
 
73
72
        """See `IRunnableJob`."""
74
73
        logger = logging.getLogger()
75
74
        logger.info('Updating statistics for %s' % self.pofile.title)
76
 
        # First update the statistics for the POFile that was directly
77
 
        # modified.
78
75
        self.pofile.updateStatistics()
79
76
 
80
 
        # Next we have to find any POFiles that share translations with the
81
 
        # above POFile so we can update their statistics too.  To do that we
82
 
        # first have to find the set of shared templates.
83
 
        subset = getUtility(IPOTemplateSet).getSharingSubset(
84
 
            product=self.pofile.potemplate.product)
85
 
        shared_templates = subset.getSharingPOTemplates(
86
 
            self.pofile.potemplate.name)
87
 
        # Now we have to find any POFiles that translate the shared templates
88
 
        # into the same language as the POFile this job is about.
89
 
        for template in shared_templates:
90
 
            for pofile in template.pofiles:
91
 
                if pofile.language == self.pofile.language:
92
 
                    pofile.updateStatistics()
93
 
 
94
77
    @staticmethod
95
78
    def iterReady():
96
79
        """See `IJobSource`."""