← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~pappacena/launchpad:ocirecipe-edit-git-instructions into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/oci/browser/ocirecipe.py b/lib/lp/oci/browser/ocirecipe.py
> index acf83cf..464f1e9 100644
> --- a/lib/lp/oci/browser/ocirecipe.py
> +++ b/lib/lp/oci/browser/ocirecipe.py
> @@ -898,6 +901,37 @@ class OCIRecipeEditView(BaseOCIRecipeEditView, EnableProcessorsMixin,
>          )
>      custom_widget_git_ref = GitRefWidget
>  
> +    def setUpGitRefWidget(self):
> +        """Setup GitRef widget indicating the user to use the default
> +        oci project's git repository, if possible.
> +        """
> +        oci_proj = self.context.oci_project
> +        widget = self.widgets["git_ref"]
> +        widget.setUpSubWidgets()
> +        msg = None
> +        if self.context.git_ref.namespace.target != self.context.oci_project:
> +            msg = ("This recipe's git repository is not in the "
> +                   "correct namespace.<br/>")
> +            default_repo = oci_proj.getDefaultGitRepository(self.context.owner)
> +            if default_repo:
> +                link = GitRepositoryFormatterAPI(default_repo).link('')
> +                msg += "Please, consider using %s." % link

Ok!

> +            else:
> +                msg += (
> +                    "Check the <a href='{oci_proj_url}'>OCI project page</a> "
> +                    "for instructions on how to create it correctly.")
> +        if msg:
> +            msg = structured(msg.format(
> +                oci_proj_url=canonical_url(oci_proj),
> +                repo_path=oci_proj.getDefaultGitRepositoryPath(
> +                    self.context.owner)))
> +            self.widget_errors["git_ref"] = msg.escapedtext

Fixing it.

> +
> +    def setUpWidgets(self):
> +        """See `LaunchpadFormView`."""
> +        super(OCIRecipeEditView, self).setUpWidgets()
> +        self.setUpGitRefWidget()
> +
>      def setUpFields(self):
>          """See `LaunchpadFormView`."""
>          super(OCIRecipeEditView, self).setUpFields()


-- 
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/395300
Your team Launchpad code reviewers is subscribed to branch ~pappacena/launchpad:ocirecipe-git-instructions.


References