Merge lp:~wgrant/launchpad/bug-592914-recipe-distroseries-order into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Māris Fogels on 2010-06-15 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 11016 | ||||
| Proposed branch: | lp:~wgrant/launchpad/bug-592914-recipe-distroseries-order | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
50 lines (+9/-5) 2 files modified
lib/lp/code/browser/sourcepackagerecipe.py (+7/-3) lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+2/-2) |
||||
| To merge this branch: | bzr merge lp:~wgrant/launchpad/bug-592914-recipe-distroseries-order | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Māris Fogels (community) | 2010-06-12 | Approve on 2010-06-15 | |
|
Review via email:
|
|||
Commit Message
Sort by version the distroseries list when creating recipes and builds.
Description of the Change
This branch fixes bug #592914 by sorting the distroseries vocabulary used when creating recipes and requesting builds. It's just reverse sorting by DistroSeries.
I've updated the broken test, and there is no lint.
| William Grant (wgrant) wrote : | # |
I didn't know that attrgetter could traverse multiple levels like that. I've replaced the lambda with it.
| William Grant (wgrant) wrote : | # |
It turns out that attrgetter doesn't actually work like that.
| William Grant (wgrant) wrote : | # |
I've just worked out how it passed locally: python2.6 works as you suggested, but python2.5 only works for a single level.

Hi William,
The fix looks good, but I had two concerns:
* Would it be better to use attrgetter instead of the lambda?: sorted(.., key=attrgetter( 'value. version' ))
* Just a comment, but the call to term.value.version breaks the Law of Demeter (http:// en.wikipedia. org/wiki/ Law_of_ Demeter). That often indicates an object design problem, but since we are working with data objects, I think it can pass here.
Looks good! r=mars
Maris