launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26066
[Merge] ~twom/launchpad:git-branch-picker-fix-error-message-priority-on-create into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:git-branch-picker-fix-error-message-priority-on-create into launchpad:master.
Commit message:
Fix error message order on recipe creation
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/396675
Same fix as https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/396390, but applied to the Add view as well as the Edit view.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:git-branch-picker-fix-error-message-priority-on-create into launchpad:master.
diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py
index 7cf1f94..d1bd570 100644
--- a/lib/lp/oci/browser/ocirecipe.py
+++ b/lib/lp/oci/browser/ocirecipe.py
@@ -806,6 +806,9 @@ class OCIRecipeAddView(LaunchpadFormView, EnableProcessorsMixin,
widget = self.widgets["git_ref"]
widget.setUpSubWidgets()
widget.repository_widget.setRenderedValue(path)
+ if widget.error():
+ # Do not override more important git_ref errors.
+ return
default_repo = self.context.getDefaultGitRepository(self.user)
if default_repo is None:
msg = (
diff --git a/lib/lp/oci/browser/tests/test_ocirecipe.py b/lib/lp/oci/browser/tests/test_ocirecipe.py
index 35b9dd8..7c3ccdb 100644
--- a/lib/lp/oci/browser/tests/test_ocirecipe.py
+++ b/lib/lp/oci/browser/tests/test_ocirecipe.py
@@ -446,6 +446,21 @@ class TestOCIRecipeAddView(BaseTestOCIRecipeView):
"of this recipe.")
self.assertIn(error_message, browser.contents)
+ def test_create_recipe_doesnt_override_gitref_errors(self):
+ oci_project = self.factory.makeOCIProject()
+ [git_ref] = self.factory.makeGitRefs()
+ browser = self.getViewBrowser(
+ oci_project, view_name="+new-recipe", user=self.person)
+ browser.getControl(name="field.name").value = "recipe-name"
+ browser.getControl("Description").value = "Recipe description"
+ browser.getControl(name="field.git_ref.repository").value = (
+ git_ref.repository.identity)
+ browser.getControl(name="field.git_ref.path").value = "non-exist"
+ browser.getControl("Create OCI recipe").click()
+
+ error_message = "does not contain a branch named"
+ self.assertIn(error_message, browser.contents)
+
class TestOCIRecipeAdminView(BaseTestOCIRecipeView):