Merge lp:~roadmr/canonical-identity-provider/webservices-launchpad-pep352 into lp:canonical-identity-provider/release

Proposed by Daniel Manrique on 2018-05-28
Status: Merged
Approved by: Daniel Manrique on 2018-05-28
Approved revision: 1644
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~roadmr/canonical-identity-provider/webservices-launchpad-pep352
Merge into: lp:canonical-identity-provider/release
Prerequisite: lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-2
Diff against target: 98 lines (+9/-9)
6 files modified
src/api/v20/tests/test_registration.py (+2/-2)
src/identityprovider/forms.py (+2/-1)
src/identityprovider/tests/test_forms.py (+2/-2)
src/webservices/launchpad.py (+1/-2)
src/webui/forms.py (+1/-1)
src/webui/tests/test_views_registration.py (+1/-1)
To merge this branch: bzr merge lp:~roadmr/canonical-identity-provider/webservices-launchpad-pep352
Reviewer Review Type Date Requested Status
Maximiliano Bertacchini 2018-05-28 Approve on 2018-05-28
Review via email: mp+346983@code.launchpad.net

Commit message

Fix PEP352-related deprecation warnings.

Most of these are not Django-related but they pop up when using -Wd (as required by newer Djangos to show deprecation warnings at all).

Description of the change

Fix PEP352-related deprecation warnings.

Most of these are not Django-related but they pop up when using -Wd (as required by newer Djangos to show deprecation warnings at all).

To post a comment you must log in.
Maximiliano Bertacchini (maxiberta) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/api/v20/tests/test_registration.py'
2--- src/api/v20/tests/test_registration.py 2018-02-09 20:56:16 +0000
3+++ src/api/v20/tests/test_registration.py 2018-05-28 15:43:00 +0000
4@@ -179,7 +179,7 @@
5 assert not Account.objects.exists()
6 e = ctx.exception
7 self.assertEqual(
8- e.message,
9+ str(e),
10 ('Dry run of setting username(%s) with dummy '
11 'openid_identifier(%s) in Launchpad failed with (%s).') % (
12 username, 'dummyID~', error_message))
13@@ -206,7 +206,7 @@
14 assert Account.objects.all().count() == 0
15 e = ctx.exception
16 self.assertEqual(
17- e.message,
18+ str(e),
19 ('Dry run of setting username(%s) with dummy '
20 'openid_identifier(%s) in Launchpad failed with (%s).') % (
21 username, 'dummyID~', error_message))
22
23=== modified file 'src/identityprovider/forms.py'
24--- src/identityprovider/forms.py 2018-05-09 20:09:35 +0000
25+++ src/identityprovider/forms.py 2018-05-28 15:43:00 +0000
26@@ -195,7 +195,8 @@
27 raise Exception(_(
28 'Dry run of setting username(%s) with dummy openid_identifier'
29 '(%s) in Launchpad failed with (%s).') % (
30- username, dummy_openid, e.message or e.msg))
31+ username, dummy_openid,
32+ e.msg if hasattr(e, 'msg') else str(e)))
33
34 return username
35
36
37=== modified file 'src/identityprovider/tests/test_forms.py'
38--- src/identityprovider/tests/test_forms.py 2018-05-09 20:50:02 +0000
39+++ src/identityprovider/tests/test_forms.py 2018-05-28 15:43:00 +0000
40@@ -351,7 +351,7 @@
41
42 e = ctx.exception
43 self.assertEqual(
44- e.message,
45+ str(e),
46 ('Dry run of setting username(%s) with dummy '
47 'openid_identifier(%s) in Launchpad failed with (%s).') % (
48 username, 'dummyID~', error_message))
49@@ -376,7 +376,7 @@
50
51 e = ctx.exception
52 self.assertEqual(
53- e.message,
54+ str(e),
55 ('Dry run of setting username(%s) with dummy '
56 'openid_identifier(%s) in Launchpad failed with (%s).') % (
57 username, 'dummyID~', error_message))
58
59=== modified file 'src/webservices/launchpad.py'
60--- src/webservices/launchpad.py 2018-03-01 11:23:13 +0000
61+++ src/webservices/launchpad.py 2018-05-28 15:43:00 +0000
62@@ -28,9 +28,8 @@
63 class LaunchpadAPIError(Exception):
64
65 def __init__(self, code, message):
66- super(LaunchpadAPIError, self).__init__()
67+ super(LaunchpadAPIError, self).__init__(message)
68 self.code = code
69- self.message = message
70
71
72 class NameAlreadyTaken(LaunchpadAPIError):
73
74=== modified file 'src/webui/forms.py'
75--- src/webui/forms.py 2016-11-01 10:53:35 +0000
76+++ src/webui/forms.py 2018-05-28 15:43:00 +0000
77@@ -66,7 +66,7 @@
78 add_lp_ssh_key(self.account.openid_identifier, keytext,
79 dry_run=True)
80 except LaunchpadAPIError as e:
81- raise forms.ValidationError(e.message)
82+ raise forms.ValidationError(str(e))
83 return keytext
84
85 def add_key_to_launchpad(self):
86
87=== modified file 'src/webui/tests/test_views_registration.py'
88--- src/webui/tests/test_views_registration.py 2018-02-14 14:05:59 +0000
89+++ src/webui/tests/test_views_registration.py 2018-05-28 15:43:00 +0000
90@@ -293,7 +293,7 @@
91
92 e = ctx.exception
93 self.assertEqual(
94- e.message,
95+ str(e),
96 ('Dry run of setting username(%s) with dummy '
97 'openid_identifier(%s) in Launchpad failed with (%s).') % (
98 username, 'dummyID~', error_message))