~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/browser/sourcepackagerecipe.py

[r=deryck][bug=845846] No oops when requesting daily build for a
 disabled archive.

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
from lp.services.features import getFeatureFlag
115
115
from lp.services.fields import PersonChoice
116
116
from lp.services.propertycache import cachedproperty
 
117
from lp.soyuz.interfaces.archive import ArchiveDisabled
117
118
from lp.soyuz.model.archive import Archive
118
119
 
119
120
 
196
197
        """Provide a link for requesting a daily build of a recipe."""
197
198
        recipe = self.context
198
199
        ppa = recipe.daily_build_archive
199
 
        if (ppa is None or not recipe.build_daily or not recipe.is_stale
200
 
                or not recipe.distroseries):
 
200
        if (ppa is None or not ppa.enabled or not recipe.build_daily or not
 
201
            recipe.is_stale or not recipe.distroseries):
201
202
            show_request_build = False
202
203
        else:
203
204
            has_upload = ppa.checkArchivePermission(recipe.owner)
544
545
        recipe = self.context
545
546
        try:
546
547
            builds = recipe.performDailyBuild()
547
 
        except TooManyBuilds, e:
 
548
        except (TooManyBuilds, ArchiveDisabled) as e:
548
549
            self.request.response.addErrorNotification(str(e))
549
550
            self.next_url = canonical_url(recipe)
550
551
            return