Merge lp:~michael.nelson/software-center/every-comm-app-already-purchased into lp:software-center

Proposed by Michael Nelson
Status: Merged
Merged at revision: 2685
Proposed branch: lp:~michael.nelson/software-center/every-comm-app-already-purchased
Merge into: lp:software-center
Diff against target: 85 lines (+20/-9)
2 files modified
softwarecenter/db/update.py (+10/-7)
test/test_reinstall_purchased.py (+10/-2)
To merge this branch: bzr merge lp:~michael.nelson/software-center/every-comm-app-already-purchased
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+89395@code.launchpad.net

Description of the change

Overview
========

This branch fixes (1) a failing test in trunk (version was added to SCAApplicationParser but not to the test data) and (2) an issue achuni noticed last night where all for-purchase apps were displaying with " (already purchased)" next to them.

-Michael

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/db/update.py'
2--- softwarecenter/db/update.py 2012-01-19 17:35:21 +0000
3+++ softwarecenter/db/update.py 2012-01-20 08:10:28 +0000
4@@ -175,11 +175,6 @@
5 self.sca_application.Comment = self.sca_application.description.split("\n")[0].strip()
6 self.sca_application.Description = "\n".join(
7 self.sca_application.description.split("\n")[1:]).strip()
8- # WARNING: item.name needs to be different than
9- # the item.name in the DB otherwise the DB
10- # gets confused about (appname, pkgname) duplication
11- self.sca_application.name = utf8(_("%s (already purchased)")) % utf8(
12- self.sca_application.name)
13
14 # XXX 2012-01-16 bug=917109
15 # We can remove these work-arounds once the above bug is fixed on
16@@ -220,8 +215,6 @@
17 self.sca_subscription = sca_subscription
18 super(SCAPurchasedApplicationParser, self).__init__(
19 PistonResponseObject.from_dict(sca_subscription.application))
20- self.sca_application.channel = (
21- PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME)
22
23 SUBSCRIPTION_MAPPING = {
24 'Deb-Line' : 'deb_line',
25@@ -248,6 +241,16 @@
26 SCAPurchasedApplicationParser, self).has_option_desktop(key)
27 return subscription_has_option or application_has_option
28
29+ def _apply_exceptions(self):
30+ super(SCAPurchasedApplicationParser, self)._apply_exceptions()
31+ # WARNING: item.name needs to be different than
32+ # the item.name in the DB otherwise the DB
33+ # gets confused about (appname, pkgname) duplication
34+ self.sca_application.name = utf8(_("%s (already purchased)")) % utf8(
35+ self.sca_application.name)
36+ self.sca_application.channel = (
37+ PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME)
38+
39
40 class JsonTagSectionParser(AppInfoParserBase):
41
42
43=== modified file 'test/test_reinstall_purchased.py'
44--- test/test_reinstall_purchased.py 2012-01-18 09:38:45 +0000
45+++ test/test_reinstall_purchased.py 2012-01-20 08:10:28 +0000
46@@ -44,7 +44,8 @@
47 "signing_key_id": "1024R/75254D99",
48 "name": "Photobomb",
49 "package_name": "photobomb",
50- "description": "Easy and Social Image Editor\\nPhotobomb give you easy access to images in your social networking feeds, pictures on your computer and peripherals, and pictures on the web, and let\'s you draw, write, crop, combine, and generally have a blast mashing \'em all up. Then you can save off your photobomb, or tweet your creation right back to your social network."
51+ "description": "Easy and Social Image Editor\\nPhotobomb give you easy access to images in your social networking feeds, pictures on your computer and peripherals, and pictures on the web, and let\'s you draw, write, crop, combine, and generally have a blast mashing \'em all up. Then you can save off your photobomb, or tweet your creation right back to your social network.",
52+ "version": "1.2.1"
53 },
54 "distro_series": {"code_name": "natty", "version": "11.04"}
55 }
56@@ -89,7 +90,8 @@
57 "tos_url": "https://software-center.ubuntu.com/licenses/3/",
58 "icon_url": "http://software-center.ubuntu.com/site_media/icons/2011/05/fluendo-dvd.png",
59 "categories": "AudioVideo",
60- "description": "Play DVD-Videos\\r\\n\\r\\nFluendo DVD Player is a software application specially designed to\\r\\nreproduce DVD on Linux/Unix platforms, which provides end users with\\r\\nhigh quality standards.\\r\\n\\r\\nThe following features are provided:\\r\\n* Full DVD Playback\\r\\n* DVD Menu support\\r\\n* Fullscreen support\\r\\n* Dolby Digital pass-through\\r\\n* Dolby Digital 5.1 output and stereo downmixing support\\r\\n* Resume from last position support\\r\\n* Subtitle support\\r\\n* Audio selection support\\r\\n* Multiple Angles support\\r\\n* Support for encrypted discs\\r\\n* Multiregion, works in all regions\\r\\n* Multiple video deinterlacing algorithms"
61+ "description": "Play DVD-Videos\\r\\n\\r\\nFluendo DVD Player is a software application specially designed to\\r\\nreproduce DVD on Linux/Unix platforms, which provides end users with\\r\\nhigh quality standards.\\r\\n\\r\\nThe following features are provided:\\r\\n* Full DVD Playback\\r\\n* DVD Menu support\\r\\n* Fullscreen support\\r\\n* Dolby Digital pass-through\\r\\n* Dolby Digital 5.1 output and stereo downmixing support\\r\\n* Resume from last position support\\r\\n* Subtitle support\\r\\n* Audio selection support\\r\\n* Multiple Angles support\\r\\n* Support for encrypted discs\\r\\n* Multiregion, works in all regions\\r\\n* Multiple video deinterlacing algorithms",
62+ "version": "1.2.1"
63 }
64 ]
65 """
66@@ -167,6 +169,11 @@
67 getattr(parser.sca_application, key),
68 parser.get_desktop(inverse_map[key]))
69
70+ def test_name_not_updated_for_non_purchased_apps(self):
71+ parser = self._make_application_parser()
72+
73+ self.assertEqual('Fluendo DVD Player', parser.get_desktop('Name'))
74+
75 def test_keys_not_provided_by_api(self):
76 parser = self._make_application_parser()
77
78@@ -249,6 +256,7 @@
79 # an application parser for handling.
80 parser = self._make_application_parser()
81
82+ # We're testing here also that the name is updated automatically.
83 expected_results = {
84 "Name": "Photobomb (already purchased)",
85 "Package": "photobomb",