~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/scripts/processaccepted.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-22 05:56:29 UTC
  • mfrom: (13492.1.1 revert-r13485)
  • Revision ID: launchpad@pqm.canonical.com-20110722055629-0y8ss6zvhjcoo12r
[r=wgrant][rollback=13485] Revert r13485. It prevents form pickers
 from being attached to their text widgets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from zope.component import getUtility
20
20
from zope.security.proxy import removeSecurityProxy
21
21
 
 
22
from canonical.launchpad.interfaces.lpstorm import IStore
22
23
from canonical.launchpad.webapp.errorlog import (
23
24
    ErrorReportingUtility,
24
25
    ScriptRequest,
30
31
from lp.bugs.interfaces.bugtask import BugTaskStatus
31
32
from lp.registry.interfaces.distribution import IDistributionSet
32
33
from lp.registry.interfaces.pocket import PackagePublishingPocket
 
34
from lp.registry.model.distroseriesparent import DistroSeriesParent
33
35
from lp.services.scripts.base import (
34
36
    LaunchpadCronScript,
35
37
    LaunchpadScriptFailure,
285
287
        else:
286
288
            self.txn.commit()
287
289
 
 
290
    def findDerivedDistros(self):
 
291
        """Find Ubuntu-derived distributions."""
 
292
        # Avoid circular imports.
 
293
        from lp.registry.model.distribution import Distribution
 
294
        from lp.registry.model.distroseries import DistroSeries
 
295
 
 
296
        ubuntu_id = getUtility(ILaunchpadCelebrities).ubuntu.id
 
297
        return IStore(DistroSeries).find(
 
298
            Distribution,
 
299
            Distribution.id == DistroSeries.distributionID,
 
300
            DistroSeries.id == DistroSeriesParent.derived_series_id,
 
301
            DistroSeries.distributionID != ubuntu_id).config(distinct=True)
 
302
 
288
303
    def findNamedDistro(self, distro_name):
289
304
        """Find the `Distribution` called `distro_name`."""
290
305
        self.logger.debug("Finding distribution %s.", distro_name)
297
312
    def findTargetDistros(self):
298
313
        """Find the distribution(s) to process, based on arguments."""
299
314
        if self.options.derived:
300
 
            return getUtility(IDistributionSet).getDerivedDistributions()
 
315
            return self.findDerivedDistros()
301
316
        else:
302
317
            return [self.findNamedDistro(self.args[0])]
303
318