Merge lp:~gary-lasker/software-center/fix-lp920741-for-5.0 into lp:software-center/5.0

Proposed by Gary Lasker on 2012-06-27
Status: Merged
Merged at revision: 2495
Proposed branch: lp:~gary-lasker/software-center/fix-lp920741-for-5.0
Merge into: lp:software-center/5.0
Diff against target: 69 lines (+22/-3)
2 files modified
softwarecenter/backend/installbackend_impl/aptd.py (+4/-3)
test/test_aptd.py (+18/-0)
To merge this branch: bzr merge lp:~gary-lasker/software-center/fix-lp920741-for-5.0
Reviewer Review Type Date Requested Status
software-store-developers 2012-06-27 Pending
Review via email: mp+112416@code.launchpad.net

Commit message

* lp:~gary-lasker/software-center/fix-lp920741-for-5.0:
   - fix UnicodeDecodeError when a commercial app's title contains
     a unicode character (LP: #920741)

Description of the change

This branch is targeted for Oneiric (the 5.0 branch), and contains a fix for a UnicodeDecodeError when a commercial app's name has a non-ascii character in it, bug 920741. It's a very simple fix and actually only involves a change to a logger info statement.

To post a comment you must log in.
2496. By Gary Lasker on 2012-06-27

add mvo's unit test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/installbackend_impl/aptd.py'
2--- softwarecenter/backend/installbackend_impl/aptd.py 2011-09-29 18:26:52 +0000
3+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-06-27 19:33:18 +0000
4@@ -497,12 +497,13 @@
5 and finally installing the specified application once the
6 package list reload has completed.
7 """
8- self.emit("transaction-started", app.pkgname, app.appname, "FIXME-NEED-ID-HERE", TransactionTypes.INSTALL)
9+ self.emit("transaction-started", app.pkgname, app.appname,
10+ "FIXME-NEED-ID-HERE", TransactionTypes.INSTALL)
11 self._logger.info("add_repo_add_key_and_install_app() '%s' '%s' '%s'"% (
12 # re.sub() out the password from the log
13 re.sub("deb https://.*@", "", deb_line),
14 signing_key_id,
15- app))
16+ app.pkgname))
17
18 if purchase:
19 # pre-authenticate
20@@ -566,7 +567,7 @@
21 See _reload_for_commercial_repo_inline() for the actual work
22 that is done
23 """
24- self._logger.info("_reload_for_commercial_repo() %s" % app)
25+ self._logger.info("_reload_for_commercial_repo() %s" % app.pkgname)
26 # trigger inline_callbacked function
27 self._reload_for_commercial_repo_defer(
28 app, trans_metadata, sources_list)
29
30=== modified file 'test/test_aptd.py'
31--- test/test_aptd.py 2011-09-29 18:16:38 +0000
32+++ test/test_aptd.py 2012-06-27 19:33:18 +0000
33@@ -1,4 +1,5 @@
34 #!/usr/bin/python
35+# -*- coding: utf-8 -*-
36
37 import os
38 import sys
39@@ -6,6 +7,7 @@
40
41
42 sys.path.insert(0,"../")
43+from softwarecenter.db.application import Application
44 from softwarecenter.backend.installbackend_impl.aptd import AptdaemonBackend
45 from defer import inline_callbacks
46
47@@ -76,6 +78,22 @@
48 addons_install = ["gimp-data-extras", "gimp-gutenprint"]
49 addons_remove = ["gimp-plugin-registry"]
50 yield self.aptd.apply_changes(pkgname, appname ,iconname, addons_install, addons_remove)
51+
52+ @inline_callbacks
53+ def _inline_add_repo_call(self):
54+ deb_line = "deb https://foo"
55+ signing_key_id = u"xxx"
56+ app = Application(u"Elementals: The Magic Key™", "pkgname")
57+ iconname = "iconname"
58+ yield self.aptd.add_repo_add_key_and_install_app(
59+ deb_line, signing_key_id, app, iconname, None, None)
60+
61+ def test_add_repo_add_key_and_install_app(self):
62+ from mock import patch
63+ with patch.object(self.aptd._logger, "info") as mock:
64+ self._inline_add_repo_call()
65+ self.assertTrue(
66+ mock.call_args[0][0].startswith("add_repo_add_key"))
67
68
69 if __name__ == "__main__":

Subscribers

People subscribed via source and target branches