Merge lp://staging/~elachuni/ubuntu-webcatalog/released-by-default into lp://staging/ubuntu-webcatalog
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Nelson | ||||
Approved revision: | 173 | ||||
Merged at revision: | 169 | ||||
Proposed branch: | lp://staging/~elachuni/ubuntu-webcatalog/released-by-default | ||||
Merge into: | lp://staging/ubuntu-webcatalog | ||||
Diff against target: |
251 lines (+117/-36) 6 files modified
src/webcatalog/management/commands/check_all_latest.py (+30/-12) src/webcatalog/managers.py (+18/-8) src/webcatalog/tests/test_commands.py (+28/-0) src/webcatalog/tests/test_managers.py (+39/-14) src/webcatalog/tests/test_models_oauth.py (+1/-1) src/webcatalog/tests/test_pep8.py (+1/-1) |
||||
To merge this branch: | bzr merge lp://staging/~elachuni/ubuntu-webcatalog/released-by-default | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | Approve | ||
Review via email: mp+121954@code.staging.launchpad.net |
Commit message
Consider prereleased distroseries when displaying app data and calculating is_latest.
Description of the change
At some point the 'prerelease' bit was added onto a distroseries. At that point I thought we had made prerelease versions of apps not show up by default, but I seem to be wrong (or the code might have been rolled back at some point?)
Related bug #1042928 asks for this again: The data an application should display by default, when no distroseries is specified, should be the latest *released* version, if there is any released version available. If there is no released version, then it's fine to display the prerelease data.
While I was there, I made the pep8 test fail when it finds an issue, as it seems it was just displaying the error but not failing the test.
On Wed, Aug 29, 2012 at 11:56 PM, Anthony Lenton /code.launchpad .net/~elachuni/ ubuntu- webcatalog/ released- by-default/ +merge/ 121954
<email address hidden> wrote:
> For more details, see:
> https:/
>
> At some point the 'prerelease' bit was added onto a distroseries. At that point I thought we had made prerelease versions of apps not
> show up by default, but I seem to be wrong (or the code might have been rolled back at some point?)
That sounds bad - have you checked?
> /code.launchpad .net/~elachuni/ ubuntu- webcatalog/ released- by-default/ +merge/ 121954 /management/ commands/ check_all_ latest. py' management/ commands/ check_all_ latest. py 2012-06-06 16:38:11 +0000 management/ commands/ check_all_ latest. py 2012-08-29 21:55:21 +0000 objects. all().update( is_latest= False) objects. values_ list('id' , 'package_name') objects. values_ list( _prerelease' ) order_by( 'package_ name', '-distroseries_ _version' ) package_ name = None package_ name != app_package_name: append( app_id) objects. filter( id__in= to_update) .update( package_ name = app_package_name
> Related bug #1042928 asks for this again: The data an application should display by default, when no distroseries is specified, should
> be the latest *released* version, if there is any released version available. If there is no released version, then it's fine to display the
> prerelease data.
>
> While I was there, I made the pep8 test fail when it finds an issue, as it seems it was just displaying the error but not failing the test.
> --
> https:/
> You are subscribed to branch lp:ubuntu-webcatalog.
>
> === modified file 'src/webcatalog
> --- src/webcatalog/
> +++ src/webcatalog/
> @@ -48,17 +48,35 @@
> Application.
>
> # 2. Update is_latest in batches of BATCH_SIZE.
> - packages = Application.
> + packages = Application.
> + 'id', 'package_name', 'distroseries_
> packages = packages.
> current_
> to_update = []
> - for app_id, app_package_name in packages:
> + prereleased = None # Store a prerelease app id here until we find
> + # a released version or run out of versions
> + for app_id, app_package_name, prerelease in packages:
> if current_
> - to_update.
> - if len(to_update) >= BATCH_SIZE:
> - Application.
> - is_latest=True)
> - to_update = []
> + is_latest = True
> current_
> + if prereleased:
> + # If prereleased != None at this point, it's because the
> + # immediately previous app *only* has prerelease versions
Ah right, so a pre-release can have is_latest=True if there aren't any prereleased_ app_id/ might be worthwhile.
other versions. Got it.
I got confused with prerelease vs prereleased... I wonder if
s/prereleased/
> + to_update. append( prereleased)
> + prereleased = None
> + if is_latest:
> + if prerelease:
> + if prereleased is None:
> + prereleased = app_id
> + else:
> + ...