Merge lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshots-for-extras-2 into lp:ubuntu-webcatalog
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Natalia Bidart | ||||
Approved revision: | 123 | ||||
Merged at revision: | 121 | ||||
Proposed branch: | lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshots-for-extras-2 | ||||
Merge into: | lp:ubuntu-webcatalog | ||||
Diff against target: |
74 lines (+30/-2) 2 files modified
src/webcatalog/management/commands/import_app_install_data.py (+7/-0) src/webcatalog/tests/test_commands.py (+23/-2) |
||||
To merge this branch: | bzr merge lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshots-for-extras-2 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Review via email: mp+105175@code.launchpad.net |
Commit message
Extract Screenshot-Url from packages metadata when present.
Description of the change
Overview
========
The first branch for this bug fixed an apparently unrelated issue, this branch fixes the actual issue that we were not pulling the screenshot url out of the package (which is where it is defined for packages in extra).
`fab test`
Details
=======
I switched off ImportAppInstal
Once coded, I've run the test (for precise) with use_mock_
You can demonstrate this working locally [3].
[1] https:/
[2] https:/
[3] https:/
Branch look pretty awesome.
One tiny note, instead of:
if 'Screenshot-Url' in package. candidateRecord : candidateRecord ['Screenshot- Url']
screenshot_url = package.
I usually prefer something like:
screenshot_url = package. candidateRecord .get('Screensho t-Url') applicationmedi a_set.create( media_type= 'screenshot' , url=screenshot_url)
if screenshot_url is not None and screenshot_url not in app.screenshots:
app.
The benefits I see in the second option are:
* you access the package. candidateRecord dict only once
* you do not duplicate the literal 'Screenshot-Url' and thus avoid risk of typos
* you avoid an if (and then another inner level in the logic)
So, if you think is worth it, feel free to tweak the code in this MP. I'll be approving anyways since this looks great.