launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01250
[Merge] lp:~rockstar/launchpad/edit-recipe-too-new into lp:launchpad/devel
Paul Hummer has proposed merging lp:~rockstar/launchpad/edit-recipe-too-new into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch fixes bug #645403 through the edit workflow. I found that this workflow wasn't fixed in the branch merge here: https://code.edge.launchpad.net/~rockstar/launchpad/recipe-too-new/+merge/36379
--
https://code.launchpad.net/~rockstar/launchpad/edit-recipe-too-new/+merge/36800
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rockstar/launchpad/edit-recipe-too-new into lp:launchpad/devel.
=== modified file 'lib/lp/code/browser/sourcepackagerecipe.py'
--- lib/lp/code/browser/sourcepackagerecipe.py 2010-09-22 20:21:57 +0000
+++ lib/lp/code/browser/sourcepackagerecipe.py 2010-09-27 21:35:55 +0000
@@ -403,6 +403,11 @@
try:
self.context.setRecipeText(recipe_text)
changed = True
+ except TooNewRecipeFormat:
+ self.setFieldError(
+ 'recipe_text',
+ 'The recipe format version specified is not available.')
+ return
except ForbiddenInstructionError:
# XXX: bug=592513 We shouldn't be hardcoding "run" here.
self.setFieldError(
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-09-22 21:03:48 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-09-27 21:35:55 +0000
@@ -445,6 +445,36 @@
extract_text(find_tags_by_class(browser.contents, 'message')[1]),
'The bzr-builder instruction "run" is not permitted here.')
+ def test_edit_recipe_format_too_new(self):
+ # If the recipe's format version is too new, we should notify the
+ # user.
+ self.factory.makeDistroSeries(
+ displayname='Mumbly Midget', name='mumbly',
+ distribution=self.ppa.distribution)
+ product = self.factory.makeProduct(
+ name='ratatouille', displayname='Ratatouille')
+ veggie_branch = self.factory.makeBranch(
+ owner=self.chef, product=product, name='veggies')
+ recipe = self.factory.makeSourcePackageRecipe(
+ owner=self.chef, registrant=self.chef,
+ name=u'things', description=u'This is a recipe',
+ distroseries=self.squirrel, branches=[veggie_branch])
+
+ new_recipe_text = dedent(u'''\
+ # bzr-builder format 145.115 deb-version 0+{revno}
+ %s
+ ''') % recipe.base_branch.bzr_identity
+
+ with recipe_parser_newest_version(145.115):
+ browser = self.getViewBrowser(recipe)
+ browser.getLink('Edit recipe').click()
+ browser.getControl('Recipe text').value = new_recipe_text
+ browser.getControl('Update Recipe').click()
+
+ self.assertEqual(
+ get_message_text(browser, 1),
+ 'The recipe format version specified is not available.')
+
def test_edit_recipe_already_exists(self):
self.factory.makeDistroSeries(
displayname='Mumbly Midget', name='mumbly',