~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/model/sourcepackagerecipebuild.py

  • Committer: Ian Booth
  • Date: 2011-05-16 04:53:14 UTC
  • mto: This revision was merged to the branch mainline in revision 13059.
  • Revision ID: ian.booth@canonical.com-20110516045314-qa68oj46xqgwky3l
Add extra logic to allow notifications to be vetoed

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
    def binary_builds(self):
91
91
        """See `ISourcePackageRecipeBuild`."""
92
92
        return Store.of(self).find(BinaryPackageBuild,
93
 
            BinaryPackageBuild.source_package_release==
 
93
            BinaryPackageBuild.source_package_release ==
94
94
            SourcePackageRelease.id,
95
 
            SourcePackageRelease.source_package_recipe_build==self.id)
 
95
            SourcePackageRelease.source_package_recipe_build == self.id)
96
96
 
97
97
    @property
98
98
    def current_component(self):
346
346
        except KeyError:
347
347
            raise NotFoundError(filename)
348
348
 
349
 
    def _handleStatus_OK(self, librarian, slave_status, logger):
 
349
    def _getAllowedStatusNotifications(self):
 
350
        # The list of build status values for which email notifications are
 
351
        # allowed to be sent. It is up to each callback as to whether it will
 
352
        # consider sending a notification but it won't do so if vetoed by this
 
353
        # list.
 
354
        return ['OK', 'PACKAGEFAIL', 'DEPFAIL', 'CHROOTFAIL']
 
355
 
 
356
    def _handleStatus_OK(self, librarian, slave_status, logger,
 
357
                         notification_allowed):
350
358
        """See `IPackageBuild`."""
351
359
        d = super(SourcePackageRecipeBuild, self)._handleStatus_OK(
352
 
            librarian, slave_status, logger)
 
360
            librarian, slave_status, logger, notification_allowed)
353
361
 
354
362
        def uploaded_build(ignored):
355
363
            # Base implementation doesn't notify on success.
356
 
            if self.status == BuildStatus.FULLYBUILT:
 
364
            if self.status == BuildStatus.FULLYBUILT and notification_allowed:
357
365
                self.notify()
358
366
        return d.addCallback(uploaded_build)
359
367