Merge lp:~wallyworld/launchpad/built-packages-listing into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Ian Booth on 2010-12-13 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 12044 |
| Proposed branch: | lp:~wallyworld/launchpad/built-packages-listing |
| Merge into: | lp:launchpad |
| Diff against target: |
740 lines (+576/-13) 11 files modified
lib/lp/code/browser/configure.zcml (+13/-6) lib/lp/code/browser/recipebuildslisting.py (+42/-0) lib/lp/code/browser/tests/test_recipebuildslisting.py (+89/-0) lib/lp/code/configure.zcml (+19/-0) lib/lp/code/interfaces/recipebuild.py (+27/-0) lib/lp/code/model/recipebuild.py (+178/-0) lib/lp/code/stories/branches/xx-bazaar-home.txt (+24/-3) lib/lp/code/templates/bazaar-index.pt (+6/-0) lib/lp/code/templates/daily-builds-listing.pt (+93/-0) lib/lp/testing/__init__.py (+7/-4) lib/lp/testing/factory.py (+78/-0) |
| To merge this branch: | bzr merge lp:~wallyworld/launchpad/built-packages-listing |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Tim Penhey (community) | Approve on 2010-12-13 | ||
| Steve Kowalik (community) | code* | 2010-11-11 | Approve on 2010-12-01 |
|
Review via email:
|
|||
Commit Message
[r=stevenk,
Description of the Change
= Summary =
Bug 671262 - provide a listing of recently built packages from recipes
= Implementation =
URL for new view is http://
A "Recent recipe builds..." link has been added to the footer of the code index page.
Displays recipe build records which have been built in the last 30 days.
New classes:
IRecipeBuildR
RecipeBuildRe
Loads recipe build records - the data model for the view.
The records for the view are constructed as a named tuple.
By default, records built in the last 30 days are loaded.
RecipeBuildRe
Extends DecoratedResultSet to override the count() method so that it works properly with the group by query.
CompletedDail
The view class - displays source package name, recipe, recipe owner, archive, most recent build datetime.
Supports display of build records where archive is PPA (in which case a link is rendered) or Primary (renders text).
Page Template
lp/
= Screenshot =
Listing page:
http://
Code home page:
http://
= Tests =
New tests:
lp.code.
The test creates records with primary and ppa archives and also outside the default 30 day window.
xx-bazaar-home.txt
Added tests to check content on code home page.
bin/test -vvt test_recipebuil
bin/test -vvt xx-baxaar-home.txt
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
logs/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
1: narrative uses a moin header.
40: narrative uses a moin header.
48: narrative uses a moin header.
83: narrative uses a moin header.
109: narrative uses a moin header.
138: narrative uses a moin header.
lib/lp/
150: E302 expected 2 blank lines, found 1
lib/lp/
130: 'anonymous_
130: 'with_anonymous
149: 'launchpadlib_for' imported but unused
149: 'launchpadlib_
130: 'person_logged_in' imported but unused
149: 'oauth_
130: 'login_celebrity' imported but unused
130: 'with_celebrity
148: 'test_tales' imported but unused
130: 'celebrity_
130: 'run_with_login' imported but unused
130: 'is_logged_in' imported but unused
130: 'with_person_
130: 'login_team' imported but unused
130: 'login_person' imported but unused
130: 'login_as' imported but unused
430: E301 expected 1 blank line, found 0
859: E301 expected 1 blank line, found 0
885: E302 expected 2 blank lines, found 1
961: E302 expected 2 blank lines, found 1
110: Line exceeds 78 characters.
| Ian Booth (wallyworld) wrote : | # |
Thanks Steve for the review.
>
> * Why are you including imports in the meat of the test, rather than with the rest of them at the top of the file?
"Personal preference". I wanted to try and avoid the top imports list
getting too large and cluttered with imports for things that were just
used in one localised place. I'll move them.
> * Would _makeRecipeBuil
Possibly, if and when those other tests get written. ATM, that method is
only used in the one file and I was thinking it best to avoid cluttering
the factory with a method that may never be used outside the test in
which is was originally written.
> * Would it make sense to fix __eq__ on SourcePackageRe
Drilling down, the __eq__ fails inside storm when attributes of
SourcePackageReipe are compared as part of the __eq__ operation. So it's
not SPR itself that needs fixing. It's a bit messy. I can't recall the
exact error ATM; it could have been because the storm reference
attributes were detached from the db and there was no connection
available to load the required data when __eq__ was invoked.
> * Use of IStoreSelector, which is deprecated. Could you look at switching to I{Master,}Store?
ok.
> * Please update your XXX per the XXX policy.
ok.
| Robert Collins (lifeless) wrote : | # |
A couple of meta thoughts.
On Wed, Nov 24, 2010 at 2:31 AM, Ian Booth <email address hidden> wrote:
> Thanks Steve for the review.
>
>>
>> * Why are you including imports in the meat of the test, rather than with the rest of them at the top of the file?
>
> "Personal preference". I wanted to try and avoid the top imports list
> getting too large and cluttered with imports for things that were just
> used in one localised place. I'll move them.
While I feel the same pressure the thing is that this quickly becomes
larger-
fixing it becomes a global-scan of the file to find such imports. My
personal conclusion has been that its a pessimisation to do such local
imports with a couple of caveats:
- in some dynamic-loading scenarios I'll import globally with an
ImportError catch and import in the test to show the actual error if
things don't import, as a test failure
- circular imports [which should rarely if ever affect tests].
>> * Would _makeRecipeBuil
>
> Possibly, if and when those other tests get written. ATM, that method is
> only used in the one file and I was thinking it best to avoid cluttering
> the factory with a method that may never be used outside the test in
> which is was originally written.
Similar to the import issue, this is a lurking maintenance problem:
how will someone else working on this know to look in your test script
for a test helper. If the helper is truely specfic, then they don't
need to. If you were to write recipe tests elsewhere, would you want
this helper? If so, I think its worth being kind to your future self
and making it discoverable (using whatever idioms we are using at the
time to do that: the current one being 'extend the factory Luke').
-Rob
| Tim Penhey (thumper) wrote : | # |
Additional review comments:
There are a lot of classes and methods that don't have docstrings. Even a
short docstring is often more useful than nothing.
PEP-8 says a blank line between class definition line and methods.
sorted(builds, key=attrgetter(
and sort on something that is unique and has a __lt__ implementation.
expected_text = "No recently completed daily builds found."
is more readable IMO than: (also PEP-8)
expected_text = """
No recently completed daily builds found.
"""
In the bazaar doctest, instead of using browser.goBack(), just open the page
directly. This way I don't have to know where the browser was before.
You want to avoid string concatenation in the TAL:
tal:attribute
string:
This should be change to be a method somewhere either in the view or the items
in the result set. That way it would just be:
tal:attribute
| Ian Booth (wallyworld) wrote : | # |
Thanks for the review.
>
> There are a lot of classes and methods that don't have docstrings. Even a
> short docstring is often more useful than nothing.
>
Done.
> PEP-8 says a blank line between class definition line and methods.
>
> sorted(builds, key=attrgetter(
> and sort on something that is unique and has a __lt__ implementation.
>
RecipeBuildRecord, being a named tuple of entities, doesn't have an id
attribute so this suggestion is not relevant here.
> expected_text = "No recently completed daily builds found."
>
> is more readable IMO than: (also PEP-8)
>
> expected_text = """
> No recently completed daily builds found.
> """
Indeed.
>
> In the bazaar doctest, instead of using browser.goBack(), just open the page
> directly. This way I don't have to know where the browser was before.
>
The original test was written using browser.goBack() so I was extending
what was there already. I've implemented the suggestion and as a drive
by fixed the other places where goBack() was used.
> You want to avoid string concatenation in the TAL:
> tal:attributes=
> string:
>
> This should be change to be a method somewhere either in the view or the items
> in the result set. That way it would just be:
>
> tal:attributes=
>
>
My original implementation was lifted exactly from:
question-
I've reworked it as per the suggestion by adding a method to the
RecipeBuildRecord class
| Steve Kowalik (stevenk) wrote : | # |
Hi Ian,
Thanks for all the clean-ups! My only comment is that your multi-line function definitions don't use the preferred form as stated in:
https:/
I'll leave it up to you if you want to change them, though.
| Tim Penhey (thumper) wrote : | # |
A few notes...
This is just styalistic, but personally I tend to use cached properties rather
than overriding initialize.
In lib/lp/
just to use the appserver_root_url. The layers use inheritance and the method
is a class method, so you can call that through the DatabaseFunctio
So you can do:
root_url = self.layer.
rather than:
root_url = BaseLayer.
and avoid an extra import.
Also, can you please change the code.launchpad.dev page to look like:
http://
I think it reads much better. The first two parts are optional, the changing of the wording on the main page isn't. Since it is a pure appearance thing, I'll approve now.

Hi,
This mostly looks good. I have a few comments:
* Why are you including imports in the meat of the test, rather than with the rest of them at the top of the file? dRecords( ) better exist in the factory so other tests could make use of it? cipe, rather than working around it?
* Would _makeRecipeBuil
* Would it make sense to fix __eq__ on SourcePackageRe
* Use of IStoreSelector, which is deprecated. Could you look at switching to I{Master,}Store?
* Please update your XXX per the XXX policy.