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

Proposed by Gary Lasker
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 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

add mvo's unit test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/backend/installbackend_impl/aptd.py'
--- softwarecenter/backend/installbackend_impl/aptd.py 2011-09-29 18:26:52 +0000
+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-06-27 19:33:18 +0000
@@ -497,12 +497,13 @@
497 and finally installing the specified application once the497 and finally installing the specified application once the
498 package list reload has completed.498 package list reload has completed.
499 """499 """
500 self.emit("transaction-started", app.pkgname, app.appname, "FIXME-NEED-ID-HERE", TransactionTypes.INSTALL)500 self.emit("transaction-started", app.pkgname, app.appname,
501 "FIXME-NEED-ID-HERE", TransactionTypes.INSTALL)
501 self._logger.info("add_repo_add_key_and_install_app() '%s' '%s' '%s'"% (502 self._logger.info("add_repo_add_key_and_install_app() '%s' '%s' '%s'"% (
502 # re.sub() out the password from the log503 # re.sub() out the password from the log
503 re.sub("deb https://.*@", "", deb_line),504 re.sub("deb https://.*@", "", deb_line),
504 signing_key_id, 505 signing_key_id,
505 app))506 app.pkgname))
506507
507 if purchase:508 if purchase:
508 # pre-authenticate509 # pre-authenticate
@@ -566,7 +567,7 @@
566 See _reload_for_commercial_repo_inline() for the actual work567 See _reload_for_commercial_repo_inline() for the actual work
567 that is done568 that is done
568 """569 """
569 self._logger.info("_reload_for_commercial_repo() %s" % app)570 self._logger.info("_reload_for_commercial_repo() %s" % app.pkgname)
570 # trigger inline_callbacked function571 # trigger inline_callbacked function
571 self._reload_for_commercial_repo_defer(572 self._reload_for_commercial_repo_defer(
572 app, trans_metadata, sources_list)573 app, trans_metadata, sources_list)
573574
=== modified file 'test/test_aptd.py'
--- test/test_aptd.py 2011-09-29 18:16:38 +0000
+++ test/test_aptd.py 2012-06-27 19:33:18 +0000
@@ -1,4 +1,5 @@
1#!/usr/bin/python1#!/usr/bin/python
2# -*- coding: utf-8 -*-
23
3import os4import os
4import sys5import sys
@@ -6,6 +7,7 @@
67
78
8sys.path.insert(0,"../")9sys.path.insert(0,"../")
10from softwarecenter.db.application import Application
9from softwarecenter.backend.installbackend_impl.aptd import AptdaemonBackend11from softwarecenter.backend.installbackend_impl.aptd import AptdaemonBackend
10from defer import inline_callbacks12from defer import inline_callbacks
1113
@@ -76,6 +78,22 @@
76 addons_install = ["gimp-data-extras", "gimp-gutenprint"]78 addons_install = ["gimp-data-extras", "gimp-gutenprint"]
77 addons_remove = ["gimp-plugin-registry"]79 addons_remove = ["gimp-plugin-registry"]
78 yield self.aptd.apply_changes(pkgname, appname ,iconname, addons_install, addons_remove)80 yield self.aptd.apply_changes(pkgname, appname ,iconname, addons_install, addons_remove)
81
82 @inline_callbacks
83 def _inline_add_repo_call(self):
84 deb_line = "deb https://foo"
85 signing_key_id = u"xxx"
86 app = Application(u"Elementals: The Magic Key™", "pkgname")
87 iconname = "iconname"
88 yield self.aptd.add_repo_add_key_and_install_app(
89 deb_line, signing_key_id, app, iconname, None, None)
90
91 def test_add_repo_add_key_and_install_app(self):
92 from mock import patch
93 with patch.object(self.aptd._logger, "info") as mock:
94 self._inline_add_repo_call()
95 self.assertTrue(
96 mock.call_args[0][0].startswith("add_repo_add_key"))
7997
8098
81if __name__ == "__main__":99if __name__ == "__main__":

Subscribers

People subscribed via source and target branches