1
=== modified file 'aptdaemon/errors.py'
2
--- a/aptdaemon/errors.py 2012-05-16 09:16:39 +0000
3
+++ b/aptdaemon/errors.py 2012-10-08 07:54:00 +0000
5
self.details_args = args
6
AptDaemonError.__init__(self, "%s: %s" % (code, details % args))
9
+ def __unicode__(self):
10
return "Transaction failed: %s\n%s" % \
11
(aptdaemon.enums.get_error_string_from_enum(self.code),
16
+ return self.__unicode__()
18
+ return self.__unicode__().encode("utf-8")
22
class InvalidMetaDataError(AptDaemonError):
25
=== modified file 'tests/_test_py2_string_handling.py'
26
--- a/tests/_test_py2_string_handling.py 2012-05-13 16:13:40 +0000
27
+++ b/tests/_test_py2_string_handling.py 2012-10-08 07:54:00 +0000
29
self.assertRaises(MemoryError, ErrorMessage, Message(), name,
32
+ def test_dbus_exception_lp846044(self):
33
+ e = TransactionFailed("foo", "bar")
36
+ self.assertEqual(foo, u"Transaction failed: None\nä")
38
+ self.assertEqual(foo, u"Transaction failed: None\nä".encode("utf-8"))
42
if __name__ == "__main__":
45
=== added file 'tests/_test_py3_string_handling.py'
46
--- a/tests/_test_py3_string_handling.py 1970-01-01 00:00:00 +0000
47
+++ b/tests/_test_py3_string_handling.py 2012-10-08 07:54:00 +0000
49
+#!/usr/bin/env python
50
+# -*- coding: utf-8 -*-
51
+# Copyright (C) 2011 Michael Vogt <mvo@ubuntu.com>
53
+# Licensed under the GNU General Public License Version 2
55
+# This program is free software; you can redistribute it and/or modify
56
+# it under the terms of the GNU General Public License as published by
57
+# the Free Software Foundation; either version 2 of the License, or
58
+# at your option) any later version.
60
+# This program is distributed in the hope that it will be useful,
61
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
62
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63
+# GNU General Public License for more details.
65
+# You should have received a copy of the GNU General Public License
66
+# along with this program; if not, write to the Free Software
67
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
68
+# Licensed under the GNU General Public License Version 2
70
+"""Regression test for a unicode decoding error in the status_details,
71
+progress_download or error_properties attributes of the transaction,
75
+__author__ = "Michael Vogt <mvo@glatzor.de>"
79
+from aptdaemon.errors import TransactionFailed
80
+from aptdaemon.test import AptDaemonTestCase
83
+class TestUnicodeDecodingPy3(AptDaemonTestCase):
85
+ def test_dbus_exception_lp846044(self):
86
+ e = TransactionFailed("foo", "bar")
88
+ self.assertEqual(str(e), "Transaction failed: None\nä")
91
+if __name__ == "__main__":
96
=== modified file 'tests/test_py2_string_handling.py'
97
--- a/tests/test_py2_string_handling.py 2012-05-13 16:13:40 +0000
98
+++ b/tests/test_py2_string_handling.py 2012-10-08 13:37:39 +0000
101
if sys.version_info.major == 2:
102
from _test_py2_string_handling import *
105
+ from _test_py3_string_handling import *
106
+ except ImportError:
107
+ from ._test_py3_string_handling import *
110
if __name__ == "__main__":