launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12365
[Merge] lp:~stevenk/launchpad/no-render-sprrdb into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/no-render-sprrdb into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #893576 in Launchpad itself: " AttributeError: 'SourcePackageRecipeRequestDailyBuildView' object has no attribute 'index' "
https://bugs.launchpad.net/launchpad/+bug/893576
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/no-render-sprrdb/+merge/125930
SourcePackageRecipe:+request-daily-build is not a usual form. It will request a build on submit, but there are no knobs to tweak if you hit it via a GET. If it is, redirect them back to the recipe.
--
https://code.launchpad.net/~stevenk/launchpad/no-render-sprrdb/+merge/125930
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/no-render-sprrdb into lp:launchpad.
=== modified file 'lib/lp/code/browser/sourcepackagerecipe.py'
--- lib/lp/code/browser/sourcepackagerecipe.py 2012-09-05 05:08:26 +0000
+++ lib/lp/code/browser/sourcepackagerecipe.py 2012-09-24 06:33:20 +0000
@@ -541,6 +541,11 @@
# Attributes for the html version
page_title = "Build now"
+ def initialize(self):
+ super(SourcePackageRecipeRequestDailyBuildView, self).initialize()
+ if self.request.method == 'GET':
+ self.request.response.redirect(canonical_url(self.context))
+
class schema(Interface):
"""Schema for requesting a build."""
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2012-09-18 18:36:09 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2012-09-24 06:33:20 +0000
@@ -1276,6 +1276,15 @@
self.assertEqual(
[build6, build5, build4, build3, build2], view.builds)
+ def test_request_builds_redirects_on_get(self):
+ recipe = self.factory.makeSourcePackageRecipe(
+ owner=self.chef, daily_build_archive=self.ppa,
+ is_stale=True, build_daily=True)
+ with person_logged_in(self.chef):
+ url = canonical_url(recipe)
+ browser = self.getViewBrowser(recipe, '+request-daily-build')
+ self.assertEqual(url, browser.url)
+
def test_request_daily_builds_button_stale(self):
# Recipes that are stale and are built daily have a build now link
recipe = self.factory.makeSourcePackageRecipe(
Follow ups