Merge lp:~rockstar/launchpad/recipe-index-redux into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Tim Penhey on 2010-04-23 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | not available |
| Proposed branch: | lp:~rockstar/launchpad/recipe-index-redux |
| Merge into: | lp:launchpad |
| Prerequisite: | lp:~rockstar/launchpad/delete-recipe |
| Diff against target: |
314 lines (+108/-59) 4 files modified
configs/development/build-from-branch.zcml (+12/-0) lib/canonical/launchpad/browser/launchpad.py (+6/-2) lib/lp/code/browser/sourcepackagerecipe.py (+52/-4) lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+38/-53) |
| To merge this branch: | bzr merge lp:~rockstar/launchpad/recipe-index-redux |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Tim Penhey (community) | 2010-04-23 | Approve on 2010-04-23 | |
|
Review via email:
|
|||
Description of the Change
This branch does two small things in the API. The first is the change the page
title for the page to reflect the owner as well as the name of the recipe.
This was requested in a review of an earlier branch, and was quite easy to fix.
The second thing this branch does is change the Breadcrumbs to appear like so:
Paul Hummer >> Recipes >> recipe_name
...where previously it looked like this:
Paul Hummer >> Branches
I hacked it up a bit, and when I asked sinzui for guidance, he pointed me to
some things that didn't help, and then ultimately at the only place that really
messes with breadcrumb items: BranchHierarchy. I was already using that as
inspiration for what I was doing...
Here's what I had to do to make this change:
1. Define the breadcrumb adapter for SourcePackageRecipe to NameBreadcrumb.
2. Add a flag to Hierarchy that allows me to turn off the default
VHostBreadcrumb from rendering (thus removing
3. Add a SourcePackageRe
class and adapter) to render the "Recipes" link with a url.
4. Create a SourcePackageRe
SourcePackage
rending the recipe.
| Tim Penhey (thumper) wrote : | # |
| Paul Hummer (rockstar) wrote : | # |
All fixed! Here's the incremental.
=== modified file 'configs/
--- configs/
+++ configs/
@@ -103,8 +103,8 @@
<adapter
- for="lp.
- factory=
+ for="lp.
+ factory=
</facet>
<securedutility
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -47,29 +47,24 @@
from lp.registry.
-class ISourcePackageR
+class IRecipesForPers
"""A marker interface for source package recipe sets."""
-class SourcePackageRe
- """A simple class from SourcePackageRe
-
- This class is only used for making breadcrumbs.
+class RecipesForPerso
+ """A Breadcrumb that will handle the "Recipes" link for recipe breadcrumbs.
"""
- implements(
-
- def __init__(self, recipe):
- self.recipe = recipe
-
-
-class SourcePackageRe
rootsite = 'code'
text = 'Recipes'
+ implements(
+
@property
def url(self):
- return canonical_
+ # 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_
class SourcePackageRe
@@ -91,7 +86,7 @@
recipe = traversed.pop(0)
# Pop in the "Recipes" link to recipe listings.
- yield SourcePackageRe
+ yield RecipesForPerso
yield recipe
for item in traversed:

IRecipiesForPerson instead of ISourcePackageR ecipeSet
so the __init__ should take a person, not a recipe
SourcePackageRe cipeSetBreadcru mb needs a blank line after it. Actually lets merge the two classes as the class's entire purpose is to provide a breadcrumb, so it should just inherit from Breadcrumb, and provide the other interface. That way it doesn't need an adapter.