← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~cjwatson/launchpad/git-recipe-browser-listing into lp:launchpad

 

Review: Approve code



Diff comments:

> === modified file 'lib/lp/code/browser/configure.zcml'
> --- lib/lp/code/browser/configure.zcml	2015-11-23 11:34:15 +0000
> +++ lib/lp/code/browser/configure.zcml	2016-01-12 15:24:34 +0000
> @@ -1232,6 +1238,18 @@
>              name="+recipes"
>              template="../templates/sourcepackagerecipe-listing.pt"/>
>          <browser:page
> +            for="lp.code.interfaces.gitrepository.IGitRepository"
> +            class="lp.code.browser.sourcepackagerecipelisting.BranchRecipeListingView"
> +            permission="zope.Public"
> +            name="+recipes"
> +            template="../templates/sourcepackagerecipe-listing.pt"/>
> +        <browser:page
> +            for="lp.code.interfaces.gitref.IGitRef"
> +            class="lp.code.browser.sourcepackagerecipelisting.BranchRecipeListingView"
> +            permission="zope.Public"
> +            name="+recipes"
> +            template="../templates/sourcepackagerecipe-listing.pt"/>

These should really be launchpad.View, but the Branch views have the same problem so I guess security proxies take care of it.

> +        <browser:page
>              for="lp.registry.interfaces.product.IProduct"
>              class="lp.code.browser.sourcepackagerecipelisting.ProductRecipeListingView"
>              permission="zope.Public"
> 
> === modified file 'lib/lp/code/browser/gitref.py'
> --- lib/lp/code/browser/gitref.py	2015-11-30 03:03:14 +0000
> +++ lib/lp/code/browser/gitref.py	2016-01-12 15:24:34 +0000
> @@ -144,6 +146,24 @@
>      def dependent_landing_count_text(self):
>          return self._getBranchCountText(len(self.dependent_landings))
>  
> +    @property
> +    def recipes_link(self):
> +        """A link to recipes for this reference."""
> +        count = self.context.recipes.count()
> +        if count == 0:
> +            # Nothing to link to.
> +            return 'No recipes using this branch.'
> +        elif count == 1:
> +            # Link to the single recipe.
> +            return structured(
> +                '<a href="%s">1 recipe</a> using this branch.',
> +                canonical_url(self.context.recipes.one())).escapedtext
> +        else:
> +            # Link to a recipe listing.
> +            return structured(
> +                '<a href="+recipes">%s recipes</a> using this branch.',
> +                count).escapedtext

This is identical to the Branch implementation, so could be factored out.

> +
>  
>  class GitRefRegisterMergeProposalSchema(Interface):
>      """The schema to define the form for registering a new merge proposal."""


-- 
https://code.launchpad.net/~cjwatson/launchpad/git-recipe-browser-listing/+merge/282321
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References