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
=== modified file 'softwarecenter/db/update.py'
--- softwarecenter/db/update.py 2012-01-19 17:35:21 +0000
+++ softwarecenter/db/update.py 2012-01-20 08:10:28 +0000
@@ -175,11 +175,6 @@
175 self.sca_application.Comment = self.sca_application.description.split("\n")[0].strip()175 self.sca_application.Comment = self.sca_application.description.split("\n")[0].strip()
176 self.sca_application.Description = "\n".join(176 self.sca_application.Description = "\n".join(
177 self.sca_application.description.split("\n")[1:]).strip()177 self.sca_application.description.split("\n")[1:]).strip()
178 # WARNING: item.name needs to be different than
179 # the item.name in the DB otherwise the DB
180 # gets confused about (appname, pkgname) duplication
181 self.sca_application.name = utf8(_("%s (already purchased)")) % utf8(
182 self.sca_application.name)
183178
184 # XXX 2012-01-16 bug=917109179 # XXX 2012-01-16 bug=917109
185 # We can remove these work-arounds once the above bug is fixed on180 # We can remove these work-arounds once the above bug is fixed on
@@ -220,8 +215,6 @@
220 self.sca_subscription = sca_subscription215 self.sca_subscription = sca_subscription
221 super(SCAPurchasedApplicationParser, self).__init__(216 super(SCAPurchasedApplicationParser, self).__init__(
222 PistonResponseObject.from_dict(sca_subscription.application))217 PistonResponseObject.from_dict(sca_subscription.application))
223 self.sca_application.channel = (
224 PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME)
225218
226 SUBSCRIPTION_MAPPING = {219 SUBSCRIPTION_MAPPING = {
227 'Deb-Line' : 'deb_line',220 'Deb-Line' : 'deb_line',
@@ -248,6 +241,16 @@
248 SCAPurchasedApplicationParser, self).has_option_desktop(key)241 SCAPurchasedApplicationParser, self).has_option_desktop(key)
249 return subscription_has_option or application_has_option242 return subscription_has_option or application_has_option
250243
244 def _apply_exceptions(self):
245 super(SCAPurchasedApplicationParser, self)._apply_exceptions()
246 # WARNING: item.name needs to be different than
247 # the item.name in the DB otherwise the DB
248 # gets confused about (appname, pkgname) duplication
249 self.sca_application.name = utf8(_("%s (already purchased)")) % utf8(
250 self.sca_application.name)
251 self.sca_application.channel = (
252 PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME)
253
251254
252class JsonTagSectionParser(AppInfoParserBase):255class JsonTagSectionParser(AppInfoParserBase):
253256
254257
=== modified file 'test/test_reinstall_purchased.py'
--- test/test_reinstall_purchased.py 2012-01-18 09:38:45 +0000
+++ test/test_reinstall_purchased.py 2012-01-20 08:10:28 +0000
@@ -44,7 +44,8 @@
44 "signing_key_id": "1024R/75254D99",44 "signing_key_id": "1024R/75254D99",
45 "name": "Photobomb",45 "name": "Photobomb",
46 "package_name": "photobomb",46 "package_name": "photobomb",
47 "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."47 "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.",
48 "version": "1.2.1"
48 },49 },
49 "distro_series": {"code_name": "natty", "version": "11.04"}50 "distro_series": {"code_name": "natty", "version": "11.04"}
50 }51 }
@@ -89,7 +90,8 @@
89 "tos_url": "https://software-center.ubuntu.com/licenses/3/",90 "tos_url": "https://software-center.ubuntu.com/licenses/3/",
90 "icon_url": "http://software-center.ubuntu.com/site_media/icons/2011/05/fluendo-dvd.png",91 "icon_url": "http://software-center.ubuntu.com/site_media/icons/2011/05/fluendo-dvd.png",
91 "categories": "AudioVideo",92 "categories": "AudioVideo",
92 "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"93 "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",
94 "version": "1.2.1"
93 }95 }
94]96]
95"""97"""
@@ -167,6 +169,11 @@
167 getattr(parser.sca_application, key),169 getattr(parser.sca_application, key),
168 parser.get_desktop(inverse_map[key]))170 parser.get_desktop(inverse_map[key]))
169171
172 def test_name_not_updated_for_non_purchased_apps(self):
173 parser = self._make_application_parser()
174
175 self.assertEqual('Fluendo DVD Player', parser.get_desktop('Name'))
176
170 def test_keys_not_provided_by_api(self):177 def test_keys_not_provided_by_api(self):
171 parser = self._make_application_parser()178 parser = self._make_application_parser()
172179
@@ -249,6 +256,7 @@
249 # an application parser for handling.256 # an application parser for handling.
250 parser = self._make_application_parser()257 parser = self._make_application_parser()
251258
259 # We're testing here also that the name is updated automatically.
252 expected_results = {260 expected_results = {
253 "Name": "Photobomb (already purchased)",261 "Name": "Photobomb (already purchased)",
254 "Package": "photobomb",262 "Package": "photobomb",