← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~pappacena/launchpad:ocirecipe-filter-private into launchpad:master

 

Review: Approve



Diff comments:

> diff --git a/lib/lp/registry/browser/ociproject.py b/lib/lp/registry/browser/ociproject.py
> index 7c3f719..2f07dd6 100644
> --- a/lib/lp/registry/browser/ociproject.py
> +++ b/lib/lp/registry/browser/ociproject.py
> @@ -238,12 +236,18 @@ class OCIProjectIndexView(LaunchpadView):
>          return urlsplit(config.codehosting.git_ssh_root).hostname
>  
>      @cachedproperty
> +    def official_recipes(self):
> +        return self.context.getOfficialRecipes(visible_by_user=self.user)

getOfficialRecipes returns a ResultSet rather than a materialized list, so @cachedproperty doesn't cache anything useful.  Either this should just be a @property (if caching actually doesn't matter) or you should wrap this in `list()` (if it's OK to materialize the whole list up-front, i.e. no batching is needed).

> +
> +    @cachedproperty
>      def official_recipe_count(self):
> -        return self.context.getOfficialRecipes().count()
> +        return self.context.getOfficialRecipes(
> +            visible_by_user=self.user).count()
>  
>      @cachedproperty
>      def other_recipe_count(self):
> -        return self.context.getUnofficialRecipes().count()
> +        return self.context.getUnofficialRecipes(
> +            visible_by_user=self.user).count()
>  
>  
>  class OCIProjectEditView(LaunchpadEditFormView):


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


References