Merge lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshot-for-extras into lp:ubuntu-webcatalog

Proposed by Michael Nelson
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 120
Merged at revision: 118
Proposed branch: lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshot-for-extras
Merge into: lp:ubuntu-webcatalog
Diff against target: 38 lines (+15/-2)
2 files modified
src/webcatalog/tests/test_views.py (+14/-0)
src/webcatalog/views.py (+1/-2)
To merge this branch: bzr merge lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshot-for-extras
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski (community) Approve
Review via email: mp+104876@code.launchpad.net

Commit message

application_screenshots no longer dependent on redundant data (is_latest).

Description of the change

Ensures that the application_screenshots view is not dependent on redundant data (is_latest).

Another part of the fix for this should be ensuring that the check_all_latest command is run after each import (import_app_install_data and import_for_purchase), but I want to check with achuni about that first as it looks like the kind of command we wouldn't want to run unnecessarily (ie. after each import of a distroseries, but rather after importing all distroseries - which may be why it's been left manual).

`fab test`

To post a comment you must log in.
Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/webcatalog/tests/test_views.py'
--- src/webcatalog/tests/test_views.py 2012-05-04 10:20:34 +0000
+++ src/webcatalog/tests/test_views.py 2012-05-07 09:12:19 +0000
@@ -1065,6 +1065,20 @@
10651065
1066 self.assertEqual(200, response.status_code)1066 self.assertEqual(200, response.status_code)
10671067
1068 @patch('webcatalog.utilities.urllib.urlopen')
1069 def test_not_dependent_on_is_latest(self, mock_urlopen):
1070 lucid = self.factory.make_distroseries(code_name='lucid')
1071 maverick = self.factory.make_distroseries(code_name='maverick')
1072 self.factory.make_application(package_name='foo', distroseries=lucid,
1073 is_latest=False)
1074 self.factory.make_application(package_name='foo',
1075 distroseries=maverick, is_latest=False)
1076
1077 response = self.client.get(reverse('wc-package-screenshots',
1078 args=['foo']))
1079
1080 self.assertEqual(200, response.status_code)
1081
10681082
1069class ApplicationRecommendsTestCase(TestCaseWithFactory):1083class ApplicationRecommendsTestCase(TestCaseWithFactory):
10701084
10711085
=== modified file 'src/webcatalog/views.py'
--- src/webcatalog/views.py 2012-04-20 16:57:50 +0000
+++ src/webcatalog/views.py 2012-05-07 09:12:19 +0000
@@ -233,8 +233,7 @@
233233
234234
235def application_screenshots(request, package_name):235def application_screenshots(request, package_name):
236 app = get_object_or_404(Application, package_name=package_name,236 app = Application.objects.find_best_or_404(package_name=package_name)
237 is_latest=True)
238 screenshots = WebServices().get_screenshots_for_package(package_name)237 screenshots = WebServices().get_screenshots_for_package(package_name)
239 return HttpResponse(json.dumps(screenshots),238 return HttpResponse(json.dumps(screenshots),
240 mimetype='application/json')239 mimetype='application/json')

Subscribers

People subscribed via source and target branches