Code review comment for lp:~rockstar/launchpad/recipe-index-redux

Revision history for this message
Paul Hummer (rockstar) wrote :

All fixed! Here's the incremental.

=== modified file 'configs/development/build-from-branch.zcml'
--- configs/development/build-from-branch.zcml 2010-04-23 01:23:47 +0000
+++ configs/development/build-from-branch.zcml 2010-04-23 03:10:20 +0000
@@ -103,8 +103,8 @@
             permission="zope.Public"/>
         <adapter
             provides="canonical.launchpad.webapp.interfaces.IBreadcrumb"
- for="lp.code.browser.sourcepackagerecipe.ISourcePackageRecipeSet"
- factory="lp.code.browser.sourcepackagerecipe.SourcePackageRecipeSetBreadcrumb"
+ for="lp.code.browser.sourcepackagerecipe.IRecipesForPerson"
+ factory="lp.code.browser.sourcepackagerecipe.RecipesForPersonBreadcrumb"
             permission="zope.Public"/>
     </facet>
   <securedutility

=== modified file 'lib/lp/code/browser/sourcepackagerecipe.py'
--- lib/lp/code/browser/sourcepackagerecipe.py 2010-04-23 01:23:47 +0000
+++ lib/lp/code/browser/sourcepackagerecipe.py 2010-04-23 03:08:40 +0000
@@ -47,29 +47,24 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket

-class ISourcePackageRecipeSet(Interface):
+class IRecipesForPerson(Interface):
     """A marker interface for source package recipe sets."""

-class SourcePackageRecipeSet:
- """A simple class from SourcePackageRecipeSet.
-
- This class is only used for making breadcrumbs.
+class RecipesForPersonBreadcrumb(Breadcrumb):
+ """A Breadcrumb that will handle the "Recipes" link for recipe breadcrumbs.
     """

- implements(ISourcePackageRecipeSet)
-
- def __init__(self, recipe):
- self.recipe = recipe
-
-
-class SourcePackageRecipeSetBreadcrumb(Breadcrumb):
     rootsite = 'code'
     text = 'Recipes'

+ implements(IRecipesForPerson)
+
     @property
     def url(self):
- return canonical_url(self.context.recipe.owner) + '/+recipes'
+ # Yes, this looks odd, but basically, the breadcrumb code wraps this
+ # class in an instance of itself (because it's doing double duty).
+ return canonical_url(self.context.context) + '/+recipes'

 class SourcePackageRecipeHierarchy(Hierarchy):
@@ -91,7 +86,7 @@
             recipe = traversed.pop(0)

         # Pop in the "Recipes" link to recipe listings.
- yield SourcePackageRecipeSet(recipe)
+ yield RecipesForPersonBreadcrumb(recipe.owner)
         yield recipe

         for item in traversed:

« Back to merge proposal