Merge ~cjwatson/launchpad:xmlrpc-client into launchpad:master
- Git
- lp:~cjwatson/launchpad
- xmlrpc-client
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | 56a8319ea2e867c303242ee96164d32ee2bdaa53 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:xmlrpc-client |
Merge into: | launchpad:master |
Diff against target: |
2349 lines (+277/-273) 58 files modified
lib/launchpad_loggerhead/app.py (+4/-4) lib/lp/app/stories/basics/xx-opstats.txt (+3/-3) lib/lp/bugs/doc/bugtracker-tokens.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt (+1/-1) lib/lp/bugs/doc/externalbugtracker-bugzilla.txt (+30/-30) lib/lp/bugs/doc/malone-xmlrpc.txt (+3/-3) lib/lp/bugs/externalbugtracker/bugzilla.py (+18/-18) lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py (+3/-3) lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py (+2/-2) lib/lp/bugs/externalbugtracker/trac.py (+7/-7) lib/lp/bugs/externalbugtracker/xmlrpc.py (+4/-4) lib/lp/bugs/scripts/checkwatches/core.py (+1/-1) lib/lp/bugs/scripts/checkwatches/tests/test_core.py (+1/-1) lib/lp/bugs/scripts/checkwatches/utilities.py (+1/-2) lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt (+2/-2) lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt (+2/-2) lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt (+2/-2) lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt (+4/-4) lib/lp/bugs/tests/externalbugtracker.py (+23/-23) lib/lp/bugs/tests/trac-xmlrpc-transport.txt (+2/-2) lib/lp/buildmaster/interactor.py (+1/-1) lib/lp/buildmaster/tests/mock_slaves.py (+5/-5) lib/lp/buildmaster/tests/test_interactor.py (+4/-4) lib/lp/buildmaster/tests/test_manager.py (+5/-5) lib/lp/code/doc/branch-xmlrpc.txt (+2/-2) lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt (+2/-2) lib/lp/code/interfaces/codeimportscheduler.py (+2/-2) lib/lp/code/xmlrpc/branch.py (+1/-1) lib/lp/code/xmlrpc/codeimportscheduler.py (+2/-2) lib/lp/code/xmlrpc/git.py (+10/-10) lib/lp/code/xmlrpc/tests/test_branch.py (+2/-2) lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py (+7/-6) lib/lp/code/xmlrpc/tests/test_git.py (+5/-5) lib/lp/codehosting/inmemory.py (+1/-1) lib/lp/codehosting/tests/test_acceptance.py (+3/-3) lib/lp/codehosting/vfs/branchfs.py (+4/-4) lib/lp/codehosting/vfs/tests/test_branchfs.py (+2/-2) lib/lp/registry/tests/mailinglists_helper.py (+3/-2) lib/lp/registry/tests/test_mailinglistapi.py (+2/-2) lib/lp/registry/tests/test_xmlrpc.py (+6/-6) lib/lp/registry/xmlrpc/mailinglist.py (+2/-2) lib/lp/services/authserver/tests/test_authserver.py (+3/-2) lib/lp/services/features/__init__.py (+1/-1) lib/lp/services/features/tests/test_xmlrpc.py (+3/-3) lib/lp/services/librarianserver/db.py (+1/-1) lib/lp/services/tests/test_timeout.py (+3/-5) lib/lp/services/timeout.py (+1/-1) lib/lp/services/twistedsupport/xmlrpc.py (+2/-2) lib/lp/services/webapp/servers.py (+5/-5) lib/lp/services/xmlrpc.py (+8/-8) lib/lp/soyuz/model/livefsbuildbehaviour.py (+1/-1) lib/lp/soyuz/wsgi/archiveauth.py (+3/-3) lib/lp/testing/xmlrpc.py (+3/-3) lib/lp/xmlrpc/application.py (+3/-2) lib/lp/xmlrpc/configure.zcml (+36/-36) lib/lp/xmlrpc/helpers.py (+2/-1) lib/lp/xmlrpc/tests/test_private_xmlrpc.py (+8/-7) lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py (+8/-7) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email: mp+411270@code.launchpad.net |
Commit message
Import xmlrpc.client directly
Description of the change
To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/lib/launchpad_loggerhead/app.py b/lib/launchpad_loggerhead/app.py | |||
2 | index cf7e1e7..aa58d54 100644 | |||
3 | --- a/lib/launchpad_loggerhead/app.py | |||
4 | +++ b/lib/launchpad_loggerhead/app.py | |||
5 | @@ -4,6 +4,7 @@ | |||
6 | 4 | import logging | 4 | import logging |
7 | 5 | import os | 5 | import os |
8 | 6 | import threading | 6 | import threading |
9 | 7 | import xmlrpc.client | ||
10 | 7 | 8 | ||
11 | 8 | from breezy import ( | 9 | from breezy import ( |
12 | 9 | errors, | 10 | errors, |
13 | @@ -40,7 +41,6 @@ from paste.request import ( | |||
14 | 40 | path_info_pop, | 41 | path_info_pop, |
15 | 41 | ) | 42 | ) |
16 | 42 | import six | 43 | import six |
17 | 43 | from six.moves import xmlrpc_client | ||
18 | 44 | from six.moves.urllib.parse import ( | 44 | from six.moves.urllib.parse import ( |
19 | 45 | urlencode, | 45 | urlencode, |
20 | 46 | urljoin, | 46 | urljoin, |
21 | @@ -72,7 +72,7 @@ thread_locals = threading.local() | |||
22 | 72 | def check_fault(fault, *fault_classes): | 72 | def check_fault(fault, *fault_classes): |
23 | 73 | """Check if 'fault's faultCode matches any of 'fault_classes'. | 73 | """Check if 'fault's faultCode matches any of 'fault_classes'. |
24 | 74 | 74 | ||
26 | 75 | :param fault: An instance of `xmlrpc_client.Fault`. | 75 | :param fault: An instance of `xmlrpc.client.Fault`. |
27 | 76 | :param fault_classes: Any number of `LaunchpadFault` subclasses. | 76 | :param fault_classes: Any number of `LaunchpadFault` subclasses. |
28 | 77 | """ | 77 | """ |
29 | 78 | for cls in fault_classes: | 78 | for cls in fault_classes: |
30 | @@ -98,7 +98,7 @@ class RootApp: | |||
31 | 98 | def get_branchfs(self): | 98 | def get_branchfs(self): |
32 | 99 | t = getattr(thread_locals, 'branchfs', None) | 99 | t = getattr(thread_locals, 'branchfs', None) |
33 | 100 | if t is None: | 100 | if t is None: |
35 | 101 | thread_locals.branchfs = xmlrpc_client.ServerProxy( | 101 | thread_locals.branchfs = xmlrpc.client.ServerProxy( |
36 | 102 | config.codehosting.codehosting_endpoint) | 102 | config.codehosting.codehosting_endpoint) |
37 | 103 | return thread_locals.branchfs | 103 | return thread_locals.branchfs |
38 | 104 | 104 | ||
39 | @@ -221,7 +221,7 @@ class RootApp: | |||
40 | 221 | branchfs = self.get_branchfs() | 221 | branchfs = self.get_branchfs() |
41 | 222 | transport_type, info, trail = branchfs.translatePath( | 222 | transport_type, info, trail = branchfs.translatePath( |
42 | 223 | identity_url, urlutils.escape(path)) | 223 | identity_url, urlutils.escape(path)) |
44 | 224 | except xmlrpc_client.Fault as f: | 224 | except xmlrpc.client.Fault as f: |
45 | 225 | if check_fault(f, faults.PathTranslationError): | 225 | if check_fault(f, faults.PathTranslationError): |
46 | 226 | raise HTTPNotFound() | 226 | raise HTTPNotFound() |
47 | 227 | elif check_fault(f, faults.PermissionDenied): | 227 | elif check_fault(f, faults.PermissionDenied): |
48 | diff --git a/lib/lp/app/stories/basics/xx-opstats.txt b/lib/lp/app/stories/basics/xx-opstats.txt | |||
49 | index 1539c53..09a1389 100644 | |||
50 | --- a/lib/lp/app/stories/basics/xx-opstats.txt | |||
51 | +++ b/lib/lp/app/stories/basics/xx-opstats.txt | |||
52 | @@ -4,9 +4,9 @@ Operational Statistics and Metrics | |||
53 | 4 | We make Zope 3 give us real time statistics about Launchpad's operation. | 4 | We make Zope 3 give us real time statistics about Launchpad's operation. |
54 | 5 | We can access them via XML-RPC: | 5 | We can access them via XML-RPC: |
55 | 6 | 6 | ||
57 | 7 | >>> from six.moves import xmlrpc_client | 7 | >>> import xmlrpc.client |
58 | 8 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport | 8 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
60 | 9 | >>> lp_xmlrpc = xmlrpc_client.ServerProxy( | 9 | >>> lp_xmlrpc = xmlrpc.client.ServerProxy( |
61 | 10 | ... 'http://xmlrpc.launchpad.test/+opstats', | 10 | ... 'http://xmlrpc.launchpad.test/+opstats', |
62 | 11 | ... transport=XMLRPCTestTransport() | 11 | ... transport=XMLRPCTestTransport() |
63 | 12 | ... ) | 12 | ... ) |
64 | @@ -192,7 +192,7 @@ Number of XML-RPC Faults | |||
65 | 192 | ... try: | 192 | ... try: |
66 | 193 | ... opstats = lp_xmlrpc.invalid() # XXX: Need a HTTP test too | 193 | ... opstats = lp_xmlrpc.invalid() # XXX: Need a HTTP test too |
67 | 194 | ... print('Should have raised a Fault exception!') | 194 | ... print('Should have raised a Fault exception!') |
69 | 195 | ... except xmlrpc_client.Fault: | 195 | ... except xmlrpc.client.Fault: |
70 | 196 | ... pass | 196 | ... pass |
71 | 197 | >>> report() | 197 | >>> report() |
72 | 198 | requests: 1 | 198 | requests: 1 |
73 | diff --git a/lib/lp/bugs/doc/bugtracker-tokens.txt b/lib/lp/bugs/doc/bugtracker-tokens.txt | |||
74 | index a32f050..0d5d6e8 100644 | |||
75 | --- a/lib/lp/bugs/doc/bugtracker-tokens.txt | |||
76 | +++ b/lib/lp/bugs/doc/bugtracker-tokens.txt | |||
77 | @@ -3,12 +3,12 @@ Using BugTracker Login Tokens | |||
78 | 3 | 3 | ||
79 | 4 | Launchpad offers an XML-RPC interface for generating bug tracker tokens. | 4 | Launchpad offers an XML-RPC interface for generating bug tracker tokens. |
80 | 5 | 5 | ||
82 | 6 | >>> from six.moves import xmlrpc_client | 6 | >>> import xmlrpc.client |
83 | 7 | >>> from zope.component import getUtility | 7 | >>> from zope.component import getUtility |
84 | 8 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport | 8 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
85 | 9 | >>> from lp.services.verification.interfaces.logintoken import ( | 9 | >>> from lp.services.verification.interfaces.logintoken import ( |
86 | 10 | ... ILoginTokenSet) | 10 | ... ILoginTokenSet) |
88 | 11 | >>> bugtracker_api = xmlrpc_client.ServerProxy( | 11 | >>> bugtracker_api = xmlrpc.client.ServerProxy( |
89 | 12 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', | 12 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', |
90 | 13 | ... transport=XMLRPCTestTransport()) | 13 | ... transport=XMLRPCTestTransport()) |
91 | 14 | 14 | ||
92 | diff --git a/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt b/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt | |||
93 | index 218e38d..579ba33 100644 | |||
94 | --- a/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt | |||
95 | +++ b/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt | |||
96 | @@ -130,7 +130,7 @@ login_required() and will retry the method call. | |||
97 | 130 | 130 | ||
98 | 131 | If authentication fails, a BugTrackerAuthenticationError will be raised. | 131 | If authentication fails, a BugTrackerAuthenticationError will be raised. |
99 | 132 | 132 | ||
101 | 133 | >>> from six.moves.xmlrpc_client import Fault, ProtocolError | 133 | >>> from xmlrpc.client import Fault, ProtocolError |
102 | 134 | >>> class TestAuthFailingBugzillaXMLRPCTransport( | 134 | >>> class TestAuthFailingBugzillaXMLRPCTransport( |
103 | 135 | ... ZopelessBugzillaXMLRPCTransport): | 135 | ... ZopelessBugzillaXMLRPCTransport): |
104 | 136 | ... error = Fault(100, "Sorry, you can't log in.") | 136 | ... error = Fault(100, "Sorry, you can't log in.") |
105 | diff --git a/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt b/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt | |||
106 | index d04257a..7ecb403 100644 | |||
107 | --- a/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt | |||
108 | +++ b/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt | |||
109 | @@ -86,25 +86,25 @@ ExternalBugTracker will be returned. | |||
110 | 86 | The Bugzilla ExternalBugTracker has a _test_xmlrpc_proxy property which | 86 | The Bugzilla ExternalBugTracker has a _test_xmlrpc_proxy property which |
111 | 87 | we override for the purpose of this test. | 87 | we override for the purpose of this test. |
112 | 88 | 88 | ||
115 | 89 | >>> from six.moves import xmlrpc_client | 89 | >>> import xmlrpc.client |
116 | 90 | >>> class FailingXMLRPCTransport(xmlrpc_client.Transport): | 90 | >>> class FailingXMLRPCTransport(xmlrpc.client.Transport): |
117 | 91 | ... | 91 | ... |
120 | 92 | ... error = xmlrpc_client.Fault( | 92 | ... error = xmlrpc.client.Fault( |
121 | 93 | ... xmlrpc_client.METHOD_NOT_FOUND, "Method doesn't exist") | 93 | ... xmlrpc.client.METHOD_NOT_FOUND, "Method doesn't exist") |
122 | 94 | ... | 94 | ... |
123 | 95 | ... def request(self, host, handler, request, verbose=None): | 95 | ... def request(self, host, handler, request, verbose=None): |
124 | 96 | ... if self.error is not None: | 96 | ... if self.error is not None: |
125 | 97 | ... raise self.error | 97 | ... raise self.error |
126 | 98 | ... else: | 98 | ... else: |
127 | 99 | ... # We need to return something here, otherwise | 99 | ... # We need to return something here, otherwise |
129 | 100 | ... # xmlrpc_client will explode. | 100 | ... # xmlrpc.client will explode. |
130 | 101 | ... return '0.42-test' | 101 | ... return '0.42-test' |
131 | 102 | ... | 102 | ... |
132 | 103 | >>> test_transport = FailingXMLRPCTransport() | 103 | >>> test_transport = FailingXMLRPCTransport() |
133 | 104 | 104 | ||
134 | 105 | >>> class BugzillaWithFakeProxy(Bugzilla): | 105 | >>> class BugzillaWithFakeProxy(Bugzilla): |
135 | 106 | ... | 106 | ... |
137 | 107 | ... _test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 107 | ... _test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
138 | 108 | ... 'http://example.com/xmlrpc.cgi', transport=test_transport) | 108 | ... 'http://example.com/xmlrpc.cgi', transport=test_transport) |
139 | 109 | 109 | ||
140 | 110 | >>> bugzilla = BugzillaWithFakeProxy('http://example.com') | 110 | >>> bugzilla = BugzillaWithFakeProxy('http://example.com') |
141 | @@ -129,7 +129,7 @@ BugzillaAPI instance. | |||
142 | 129 | The same is true if getExternalBugTrackerToUse() receives a 404 error | 129 | The same is true if getExternalBugTrackerToUse() receives a 404 error |
143 | 130 | from the remote server. | 130 | from the remote server. |
144 | 131 | 131 | ||
146 | 132 | >>> test_transport.error = xmlrpc_client.ProtocolError( | 132 | >>> test_transport.error = xmlrpc.client.ProtocolError( |
147 | 133 | ... 'http://example.com/xmlrpc.cgi', 404, 'Not Found', None) | 133 | ... 'http://example.com/xmlrpc.cgi', 404, 'Not Found', None) |
148 | 134 | 134 | ||
149 | 135 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() | 135 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() |
150 | @@ -141,7 +141,7 @@ from the remote server. | |||
151 | 141 | Some Bugzillas respond to an invalid XML-RPC method call by returning a | 141 | Some Bugzillas respond to an invalid XML-RPC method call by returning a |
152 | 142 | 500 error. getExternalBugTrackerToUse() handles those, too. | 142 | 500 error. getExternalBugTrackerToUse() handles those, too. |
153 | 143 | 143 | ||
155 | 144 | >>> test_transport.error = xmlrpc_client.ProtocolError( | 144 | >>> test_transport.error = xmlrpc.client.ProtocolError( |
156 | 145 | ... 'http://example.com/xmlrpc.cgi', 500, 'Server Error', None) | 145 | ... 'http://example.com/xmlrpc.cgi', 500, 'Server Error', None) |
157 | 146 | 146 | ||
158 | 147 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() | 147 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() |
159 | @@ -153,7 +153,7 @@ Some Bugzillas respond to an invalid XML-RPC method call by returning a | |||
160 | 153 | Some other Bugzillas generate an unparsable response, causing | 153 | Some other Bugzillas generate an unparsable response, causing |
161 | 154 | ResponseError to be raised. | 154 | ResponseError to be raised. |
162 | 155 | 155 | ||
164 | 156 | >>> test_transport.error = xmlrpc_client.ResponseError() | 156 | >>> test_transport.error = xmlrpc.client.ResponseError() |
165 | 157 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() | 157 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() |
166 | 158 | 158 | ||
167 | 159 | >>> (isinstance(bugzilla_to_use, Bugzilla) and | 159 | >>> (isinstance(bugzilla_to_use, Bugzilla) and |
168 | @@ -164,22 +164,22 @@ If the remote Bugzilla offers the Bugzilla 3.4 API, an instance of | |||
169 | 164 | BuzillaAPI will be returned. To test this, we use a specially-crafted | 164 | BuzillaAPI will be returned. To test this, we use a specially-crafted |
170 | 165 | XML-RPC proxy that behaves like a Bugzilla 3.4 instance. | 165 | XML-RPC proxy that behaves like a Bugzilla 3.4 instance. |
171 | 166 | 166 | ||
173 | 167 | >>> class APIXMLRPCTransport(xmlrpc_client.Transport): | 167 | >>> class APIXMLRPCTransport(xmlrpc.client.Transport): |
174 | 168 | ... | 168 | ... |
175 | 169 | ... version = '3.4.2' | 169 | ... version = '3.4.2' |
176 | 170 | ... | 170 | ... |
177 | 171 | ... def request(self, host, handler, request, verbose=None): | 171 | ... def request(self, host, handler, request, verbose=None): |
179 | 172 | ... args, method_name = xmlrpc_client.loads(request) | 172 | ... args, method_name = xmlrpc.client.loads(request) |
180 | 173 | ... | 173 | ... |
181 | 174 | ... if method_name == 'Bugzilla.version': | 174 | ... if method_name == 'Bugzilla.version': |
182 | 175 | ... return [{'version': self.version}] | 175 | ... return [{'version': self.version}] |
183 | 176 | ... else: | 176 | ... else: |
186 | 177 | ... raise xmlrpc_client.Fault( | 177 | ... raise xmlrpc.client.Fault( |
187 | 178 | ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method') | 178 | ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method') |
188 | 179 | ... | 179 | ... |
189 | 180 | >>> test_transport = APIXMLRPCTransport() | 180 | >>> test_transport = APIXMLRPCTransport() |
190 | 181 | 181 | ||
192 | 182 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 182 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
193 | 183 | ... 'http://example.com/xmlrpc.cgi', | 183 | ... 'http://example.com/xmlrpc.cgi', |
194 | 184 | ... transport=test_transport) | 184 | ... transport=test_transport) |
195 | 185 | 185 | ||
196 | @@ -193,7 +193,7 @@ A version older than 3.4 is not accepted. | |||
197 | 193 | >>> test_transport = APIXMLRPCTransport() | 193 | >>> test_transport = APIXMLRPCTransport() |
198 | 194 | >>> test_transport.version = '3.3' | 194 | >>> test_transport.version = '3.3' |
199 | 195 | 195 | ||
201 | 196 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 196 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
202 | 197 | ... 'http://example.com/xmlrpc.cgi', | 197 | ... 'http://example.com/xmlrpc.cgi', |
203 | 198 | ... transport=test_transport) | 198 | ... transport=test_transport) |
204 | 199 | 199 | ||
205 | @@ -206,7 +206,7 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted. | |||
206 | 206 | >>> test_transport = APIXMLRPCTransport() | 206 | >>> test_transport = APIXMLRPCTransport() |
207 | 207 | >>> test_transport.version = '20181108.1' | 207 | >>> test_transport.version = '20181108.1' |
208 | 208 | 208 | ||
210 | 209 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 209 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
211 | 210 | ... 'http://example.com/xmlrpc.cgi', | 210 | ... 'http://example.com/xmlrpc.cgi', |
212 | 211 | ... transport=test_transport) | 211 | ... transport=test_transport) |
213 | 212 | 212 | ||
214 | @@ -218,20 +218,20 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted. | |||
215 | 218 | If the remote system has the Launchpad plugin installed, an | 218 | If the remote system has the Launchpad plugin installed, an |
216 | 219 | getExternalBugTrackerToUse() will return a BugzillaLPPlugin instance. | 219 | getExternalBugTrackerToUse() will return a BugzillaLPPlugin instance. |
217 | 220 | 220 | ||
219 | 221 | >>> class PluginXMLRPCTransport(xmlrpc_client.Transport): | 221 | >>> class PluginXMLRPCTransport(xmlrpc.client.Transport): |
220 | 222 | ... | 222 | ... |
221 | 223 | ... def request(self, host, handler, request, verbose=None): | 223 | ... def request(self, host, handler, request, verbose=None): |
223 | 224 | ... args, method_name = xmlrpc_client.loads(request) | 224 | ... args, method_name = xmlrpc.client.loads(request) |
224 | 225 | ... | 225 | ... |
225 | 226 | ... if method_name == 'Launchpad.plugin_version': | 226 | ... if method_name == 'Launchpad.plugin_version': |
226 | 227 | ... return [{'version': '0.2'}] | 227 | ... return [{'version': '0.2'}] |
227 | 228 | ... else: | 228 | ... else: |
230 | 229 | ... raise xmlrpc_client.Fault( | 229 | ... raise xmlrpc.client.Fault( |
231 | 230 | ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method') | 230 | ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method') |
232 | 231 | ... | 231 | ... |
233 | 232 | >>> test_transport = PluginXMLRPCTransport() | 232 | >>> test_transport = PluginXMLRPCTransport() |
234 | 233 | 233 | ||
236 | 234 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 234 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
237 | 235 | ... 'http://example.com/xmlrpc.cgi', | 235 | ... 'http://example.com/xmlrpc.cgi', |
238 | 236 | ... transport=test_transport) | 236 | ... transport=test_transport) |
239 | 237 | 237 | ||
240 | @@ -244,19 +244,19 @@ in response to XML-RPC calls. When something other than a mapping is | |||
241 | 244 | returned, the standard non-API non-plugin external bug tracker is | 244 | returned, the standard non-API non-plugin external bug tracker is |
242 | 245 | selected. | 245 | selected. |
243 | 246 | 246 | ||
245 | 247 | >>> class OldXMLRPCTransport(xmlrpc_client.Transport): | 247 | >>> class OldXMLRPCTransport(xmlrpc.client.Transport): |
246 | 248 | ... def request(self, host, handler, request, verbose=None): | 248 | ... def request(self, host, handler, request, verbose=None): |
248 | 249 | ... args, method_name = xmlrpc_client.loads(request) | 249 | ... args, method_name = xmlrpc.client.loads(request) |
249 | 250 | ... | 250 | ... |
250 | 251 | ... if method_name == 'Bugzilla.version': | 251 | ... if method_name == 'Bugzilla.version': |
251 | 252 | ... return ('versionResponse', {'version': '3.2.5+'}) | 252 | ... return ('versionResponse', {'version': '3.2.5+'}) |
252 | 253 | ... else: | 253 | ... else: |
255 | 254 | ... raise xmlrpc_client.Fault( | 254 | ... raise xmlrpc.client.Fault( |
256 | 255 | ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method') | 255 | ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method') |
257 | 256 | ... | 256 | ... |
258 | 257 | >>> test_transport = OldXMLRPCTransport() | 257 | >>> test_transport = OldXMLRPCTransport() |
259 | 258 | 258 | ||
261 | 259 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 259 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
262 | 260 | ... 'http://example.com/xmlrpc.cgi', | 260 | ... 'http://example.com/xmlrpc.cgi', |
263 | 261 | ... transport=test_transport) | 261 | ... transport=test_transport) |
264 | 262 | 262 | ||
265 | @@ -270,18 +270,18 @@ is not discovered over XML-RPC. It's not clear if this is an error in | |||
266 | 270 | Bugzilla or in and XML-RPC library used by Bugzilla. In any case, we | 270 | Bugzilla or in and XML-RPC library used by Bugzilla. In any case, we |
267 | 271 | recognize and treat it the same as METHOD_NOT_FOUND. | 271 | recognize and treat it the same as METHOD_NOT_FOUND. |
268 | 272 | 272 | ||
270 | 273 | >>> class OldBrokenXMLRPCTransport(xmlrpc_client.Transport): | 273 | >>> class OldBrokenXMLRPCTransport(xmlrpc.client.Transport): |
271 | 274 | ... def request(self, host, handler, request, verbose=None): | 274 | ... def request(self, host, handler, request, verbose=None): |
273 | 275 | ... args, method_name = xmlrpc_client.loads(request) | 275 | ... args, method_name = xmlrpc.client.loads(request) |
274 | 276 | ... | 276 | ... |
275 | 277 | ... if method_name == 'Bugzilla.version': | 277 | ... if method_name == 'Bugzilla.version': |
276 | 278 | ... return ('versionResponse', {'version': '3.2.5+'}) | 278 | ... return ('versionResponse', {'version': '3.2.5+'}) |
277 | 279 | ... else: | 279 | ... else: |
279 | 280 | ... raise xmlrpc_client.Fault('Client', 'No such method') | 280 | ... raise xmlrpc.client.Fault('Client', 'No such method') |
280 | 281 | ... | 281 | ... |
281 | 282 | >>> test_transport = OldBrokenXMLRPCTransport() | 282 | >>> test_transport = OldBrokenXMLRPCTransport() |
282 | 283 | 283 | ||
284 | 284 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 284 | >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
285 | 285 | ... 'http://example.com/xmlrpc.cgi', | 285 | ... 'http://example.com/xmlrpc.cgi', |
286 | 286 | ... transport=test_transport) | 286 | ... transport=test_transport) |
287 | 287 | 287 | ||
288 | diff --git a/lib/lp/bugs/doc/malone-xmlrpc.txt b/lib/lp/bugs/doc/malone-xmlrpc.txt | |||
289 | index 0be732d..4b5ee05 100644 | |||
290 | --- a/lib/lp/bugs/doc/malone-xmlrpc.txt | |||
291 | +++ b/lib/lp/bugs/doc/malone-xmlrpc.txt | |||
292 | @@ -3,9 +3,9 @@ XML-RPC Integration with Malone | |||
293 | 3 | 3 | ||
294 | 4 | Malone provides an XML-RPC interface for filing bugs. | 4 | Malone provides an XML-RPC interface for filing bugs. |
295 | 5 | 5 | ||
297 | 6 | >>> from six.moves import xmlrpc_client | 6 | >>> import xmlrpc.client |
298 | 7 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport | 7 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
300 | 8 | >>> filebug_api = xmlrpc_client.ServerProxy( | 8 | >>> filebug_api = xmlrpc.client.ServerProxy( |
301 | 9 | ... 'http://test@canonical.com:test@xmlrpc.launchpad.test/bugs/', | 9 | ... 'http://test@canonical.com:test@xmlrpc.launchpad.test/bugs/', |
302 | 10 | ... transport=XMLRPCTestTransport()) | 10 | ... transport=XMLRPCTestTransport()) |
303 | 11 | 11 | ||
304 | @@ -278,7 +278,7 @@ The LoginToken generated will be of the LoginTokenType BUGTRACKER. | |||
305 | 278 | 278 | ||
306 | 279 | These requests are all handled by the private xml-rpc server. | 279 | These requests are all handled by the private xml-rpc server. |
307 | 280 | 280 | ||
309 | 281 | >>> bugtracker_api = xmlrpc_client.ServerProxy( | 281 | >>> bugtracker_api = xmlrpc.client.ServerProxy( |
310 | 282 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', | 282 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', |
311 | 283 | ... transport=XMLRPCTestTransport()) | 283 | ... transport=XMLRPCTestTransport()) |
312 | 284 | 284 | ||
313 | diff --git a/lib/lp/bugs/externalbugtracker/bugzilla.py b/lib/lp/bugs/externalbugtracker/bugzilla.py | |||
314 | index 5269ebc..7a84697 100644 | |||
315 | --- a/lib/lp/bugs/externalbugtracker/bugzilla.py | |||
316 | +++ b/lib/lp/bugs/externalbugtracker/bugzilla.py | |||
317 | @@ -14,12 +14,12 @@ from email.utils import parseaddr | |||
318 | 14 | from http.client import BadStatusLine | 14 | from http.client import BadStatusLine |
319 | 15 | import re | 15 | import re |
320 | 16 | import xml.parsers.expat | 16 | import xml.parsers.expat |
321 | 17 | import xmlrpc.client | ||
322 | 17 | 18 | ||
323 | 18 | from defusedxml import minidom | 19 | from defusedxml import minidom |
324 | 19 | import pytz | 20 | import pytz |
325 | 20 | import requests | 21 | import requests |
326 | 21 | import six | 22 | import six |
327 | 22 | from six.moves import xmlrpc_client | ||
328 | 23 | from zope.component import getUtility | 23 | from zope.component import getUtility |
329 | 24 | from zope.interface import ( | 24 | from zope.interface import ( |
330 | 25 | alsoProvides, | 25 | alsoProvides, |
331 | @@ -90,15 +90,15 @@ class Bugzilla(ExternalBugTracker): | |||
332 | 90 | # We try calling Bugzilla.version() on the remote | 90 | # We try calling Bugzilla.version() on the remote |
333 | 91 | # server because it's the most lightweight method there is. | 91 | # server because it's the most lightweight method there is. |
334 | 92 | remote_version = proxy.Bugzilla.version() | 92 | remote_version = proxy.Bugzilla.version() |
336 | 93 | except xmlrpc_client.Fault as fault: | 93 | except xmlrpc.client.Fault as fault: |
337 | 94 | # 'Client' is a hangover. Either Bugzilla or the Perl | 94 | # 'Client' is a hangover. Either Bugzilla or the Perl |
338 | 95 | # XML-RPC lib in use returned it as faultCode. It's wrong, | 95 | # XML-RPC lib in use returned it as faultCode. It's wrong, |
339 | 96 | # but it's known wrongness, so we recognize it here. | 96 | # but it's known wrongness, so we recognize it here. |
341 | 97 | if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'): | 97 | if fault.faultCode in (xmlrpc.client.METHOD_NOT_FOUND, 'Client'): |
342 | 98 | return False | 98 | return False |
343 | 99 | else: | 99 | else: |
344 | 100 | raise | 100 | raise |
346 | 101 | except xmlrpc_client.ProtocolError as error: | 101 | except xmlrpc.client.ProtocolError as error: |
347 | 102 | # We catch 404s, which occur when xmlrpc.cgi doesn't exist | 102 | # We catch 404s, which occur when xmlrpc.cgi doesn't exist |
348 | 103 | # on the remote server, and 500s, which sometimes occur when | 103 | # on the remote server, and 500s, which sometimes occur when |
349 | 104 | # an invalid request is made to the remote server. We allow | 104 | # an invalid request is made to the remote server. We allow |
350 | @@ -107,7 +107,7 @@ class Bugzilla(ExternalBugTracker): | |||
351 | 107 | return False | 107 | return False |
352 | 108 | else: | 108 | else: |
353 | 109 | raise | 109 | raise |
355 | 110 | except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError): | 110 | except (xmlrpc.client.ResponseError, xml.parsers.expat.ExpatError): |
356 | 111 | # The server returned an unparsable response. | 111 | # The server returned an unparsable response. |
357 | 112 | return False | 112 | return False |
358 | 113 | else: | 113 | else: |
359 | @@ -132,15 +132,15 @@ class Bugzilla(ExternalBugTracker): | |||
360 | 132 | # We try calling Launchpad.plugin_version() on the remote | 132 | # We try calling Launchpad.plugin_version() on the remote |
361 | 133 | # server because it's the most lightweight method there is. | 133 | # server because it's the most lightweight method there is. |
362 | 134 | proxy.Launchpad.plugin_version() | 134 | proxy.Launchpad.plugin_version() |
364 | 135 | except xmlrpc_client.Fault as fault: | 135 | except xmlrpc.client.Fault as fault: |
365 | 136 | # 'Client' is a hangover. Either Bugzilla or the Perl | 136 | # 'Client' is a hangover. Either Bugzilla or the Perl |
366 | 137 | # XML-RPC lib in use returned it as faultCode. It's wrong, | 137 | # XML-RPC lib in use returned it as faultCode. It's wrong, |
367 | 138 | # but it's known wrongness, so we recognize it here. | 138 | # but it's known wrongness, so we recognize it here. |
369 | 139 | if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'): | 139 | if fault.faultCode in (xmlrpc.client.METHOD_NOT_FOUND, 'Client'): |
370 | 140 | return False | 140 | return False |
371 | 141 | else: | 141 | else: |
372 | 142 | raise | 142 | raise |
374 | 143 | except xmlrpc_client.ProtocolError as error: | 143 | except xmlrpc.client.ProtocolError as error: |
375 | 144 | # We catch 404s, which occur when xmlrpc.cgi doesn't exist | 144 | # We catch 404s, which occur when xmlrpc.cgi doesn't exist |
376 | 145 | # on the remote server, and 500s, which sometimes occur when | 145 | # on the remote server, and 500s, which sometimes occur when |
377 | 146 | # the Launchpad Plugin isn't installed. Everything else we | 146 | # the Launchpad Plugin isn't installed. Everything else we |
378 | @@ -150,7 +150,7 @@ class Bugzilla(ExternalBugTracker): | |||
379 | 150 | return False | 150 | return False |
380 | 151 | else: | 151 | else: |
381 | 152 | raise | 152 | raise |
383 | 153 | except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError): | 153 | except (xmlrpc.client.ResponseError, xml.parsers.expat.ExpatError): |
384 | 154 | # The server returned an unparsable response. | 154 | # The server returned an unparsable response. |
385 | 155 | return False | 155 | return False |
386 | 156 | else: | 156 | else: |
387 | @@ -169,7 +169,7 @@ class Bugzilla(ExternalBugTracker): | |||
388 | 169 | return BugzillaLPPlugin(self.baseurl) | 169 | return BugzillaLPPlugin(self.baseurl) |
389 | 170 | elif self._remoteSystemHasBugzillaAPI(): | 170 | elif self._remoteSystemHasBugzillaAPI(): |
390 | 171 | return BugzillaAPI(self.baseurl) | 171 | return BugzillaAPI(self.baseurl) |
392 | 172 | except (xmlrpc_client.ProtocolError, requests.RequestException, | 172 | except (xmlrpc.client.ProtocolError, requests.RequestException, |
393 | 173 | BadStatusLine): | 173 | BadStatusLine): |
394 | 174 | pass | 174 | pass |
395 | 175 | return self | 175 | return self |
396 | @@ -538,14 +538,14 @@ class Bugzilla(ExternalBugTracker): | |||
397 | 538 | def needs_authentication(func): | 538 | def needs_authentication(func): |
398 | 539 | """Decorator for automatically authenticating if needed. | 539 | """Decorator for automatically authenticating if needed. |
399 | 540 | 540 | ||
401 | 541 | If an `xmlrpc_client.Fault` with error code 410 is raised by the | 541 | If an `xmlrpc.client.Fault` with error code 410 is raised by the |
402 | 542 | function, we'll try to authenticate and call the function again. | 542 | function, we'll try to authenticate and call the function again. |
403 | 543 | """ | 543 | """ |
404 | 544 | 544 | ||
405 | 545 | def decorator(self, *args, **kwargs): | 545 | def decorator(self, *args, **kwargs): |
406 | 546 | try: | 546 | try: |
407 | 547 | return func(self, *args, **kwargs) | 547 | return func(self, *args, **kwargs) |
409 | 548 | except xmlrpc_client.Fault as fault: | 548 | except xmlrpc.client.Fault as fault: |
410 | 549 | # Catch authentication errors only. | 549 | # Catch authentication errors only. |
411 | 550 | if fault.faultCode != 410: | 550 | if fault.faultCode != 410: |
412 | 551 | raise | 551 | raise |
413 | @@ -587,8 +587,8 @@ class BugzillaAPI(Bugzilla): | |||
414 | 587 | 587 | ||
415 | 588 | @property | 588 | @property |
416 | 589 | def xmlrpc_proxy(self): | 589 | def xmlrpc_proxy(self): |
419 | 590 | """Return an `xmlrpc_client.ServerProxy` to self.xmlrpc_endpoint.""" | 590 | """Return an `xmlrpc.client.ServerProxy` to self.xmlrpc_endpoint.""" |
420 | 591 | return xmlrpc_client.ServerProxy( | 591 | return xmlrpc.client.ServerProxy( |
421 | 592 | self.xmlrpc_endpoint, transport=self.xmlrpc_transport) | 592 | self.xmlrpc_endpoint, transport=self.xmlrpc_transport) |
422 | 593 | 593 | ||
423 | 594 | @property | 594 | @property |
424 | @@ -622,7 +622,7 @@ class BugzillaAPI(Bugzilla): | |||
425 | 622 | """ | 622 | """ |
426 | 623 | try: | 623 | try: |
427 | 624 | self.xmlrpc_proxy.User.login(self.credentials) | 624 | self.xmlrpc_proxy.User.login(self.credentials) |
429 | 625 | except xmlrpc_client.Fault as fault: | 625 | except xmlrpc.client.Fault as fault: |
430 | 626 | raise BugTrackerAuthenticationError( | 626 | raise BugTrackerAuthenticationError( |
431 | 627 | self.baseurl, | 627 | self.baseurl, |
432 | 628 | "Fault %s: %s" % (fault.faultCode, fault.faultString)) | 628 | "Fault %s: %s" % (fault.faultCode, fault.faultString)) |
433 | @@ -972,7 +972,7 @@ class BugzillaLPPlugin(BugzillaAPI): | |||
434 | 972 | Bugzilla_logincookie, which we can then use to re-authenticate | 972 | Bugzilla_logincookie, which we can then use to re-authenticate |
435 | 973 | ourselves for each subsequent method call. | 973 | ourselves for each subsequent method call. |
436 | 974 | """ | 974 | """ |
438 | 975 | internal_xmlrpc_server = xmlrpc_client.ServerProxy( | 975 | internal_xmlrpc_server = xmlrpc.client.ServerProxy( |
439 | 976 | config.checkwatches.xmlrpc_url, | 976 | config.checkwatches.xmlrpc_url, |
440 | 977 | transport=self.internal_xmlrpc_transport) | 977 | transport=self.internal_xmlrpc_transport) |
441 | 978 | 978 | ||
442 | @@ -981,12 +981,12 @@ class BugzillaLPPlugin(BugzillaAPI): | |||
443 | 981 | try: | 981 | try: |
444 | 982 | self.xmlrpc_proxy.Launchpad.login( | 982 | self.xmlrpc_proxy.Launchpad.login( |
445 | 983 | {'token': token_text}) | 983 | {'token': token_text}) |
447 | 984 | except xmlrpc_client.Fault as fault: | 984 | except xmlrpc.client.Fault as fault: |
448 | 985 | message = 'XML-RPC Fault: %s "%s"' % ( | 985 | message = 'XML-RPC Fault: %s "%s"' % ( |
449 | 986 | fault.faultCode, fault.faultString) | 986 | fault.faultCode, fault.faultString) |
450 | 987 | raise BugTrackerAuthenticationError( | 987 | raise BugTrackerAuthenticationError( |
451 | 988 | self.baseurl, message) | 988 | self.baseurl, message) |
453 | 989 | except xmlrpc_client.ProtocolError as error: | 989 | except xmlrpc.client.ProtocolError as error: |
454 | 990 | message = 'Protocol error: %s "%s"' % ( | 990 | message = 'Protocol error: %s "%s"' % ( |
455 | 991 | error.errcode, error.errmsg) | 991 | error.errcode, error.errmsg) |
456 | 992 | raise BugTrackerAuthenticationError( | 992 | raise BugTrackerAuthenticationError( |
457 | diff --git a/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py b/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py | |||
458 | index 2b8ea61..05bca65 100644 | |||
459 | --- a/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py | |||
460 | +++ b/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py | |||
461 | @@ -4,9 +4,9 @@ | |||
462 | 4 | """Tests for the Bugzilla BugTracker.""" | 4 | """Tests for the Bugzilla BugTracker.""" |
463 | 5 | 5 | ||
464 | 6 | from xml.parsers.expat import ExpatError | 6 | from xml.parsers.expat import ExpatError |
465 | 7 | import xmlrpc.client | ||
466 | 7 | 8 | ||
467 | 8 | import responses | 9 | import responses |
468 | 9 | from six.moves import xmlrpc_client | ||
469 | 10 | import transaction | 10 | import transaction |
470 | 11 | 11 | ||
471 | 12 | from lp.bugs.externalbugtracker.base import UnparsableBugData | 12 | from lp.bugs.externalbugtracker.base import UnparsableBugData |
472 | @@ -71,11 +71,11 @@ class TestBugzillaSniffing(TestCase): | |||
473 | 71 | # it is taken to mean that no XML-RPC capabilities exist. | 71 | # it is taken to mean that no XML-RPC capabilities exist. |
474 | 72 | bugzilla = Bugzilla("http://not.real") | 72 | bugzilla = Bugzilla("http://not.real") |
475 | 73 | 73 | ||
477 | 74 | class Transport(xmlrpc_client.Transport): | 74 | class Transport(xmlrpc.client.Transport): |
478 | 75 | def request(self, host, handler, request, verbose=None): | 75 | def request(self, host, handler, request, verbose=None): |
479 | 76 | raise ExpatError("mismatched tag") | 76 | raise ExpatError("mismatched tag") |
480 | 77 | 77 | ||
482 | 78 | bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( | 78 | bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
483 | 79 | '%s/xmlrpc.cgi' % bugzilla.baseurl, transport=Transport()) | 79 | '%s/xmlrpc.cgi' % bugzilla.baseurl, transport=Transport()) |
484 | 80 | 80 | ||
485 | 81 | # We must abort any existing transactions before attempting to call | 81 | # We must abort any existing transactions before attempting to call |
486 | diff --git a/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py b/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py | |||
487 | index b23cbe5..c473f34 100644 | |||
488 | --- a/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py | |||
489 | +++ b/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py | |||
490 | @@ -20,7 +20,7 @@ class TestRequestsTransport(TestCase): | |||
491 | 20 | 20 | ||
492 | 21 | @responses.activate | 21 | @responses.activate |
493 | 22 | def test_expat_error(self): | 22 | def test_expat_error(self): |
495 | 23 | # Malformed XML-RPC responses cause xmlrpc_client to raise an | 23 | # Malformed XML-RPC responses cause xmlrpc.client to raise an |
496 | 24 | # ExpatError. | 24 | # ExpatError. |
497 | 25 | responses.add( | 25 | responses.add( |
498 | 26 | "POST", "http://www.example.com/xmlrpc", | 26 | "POST", "http://www.example.com/xmlrpc", |
499 | @@ -28,7 +28,7 @@ class TestRequestsTransport(TestCase): | |||
500 | 28 | transport = RequestsTransport("http://not.real/") | 28 | transport = RequestsTransport("http://not.real/") |
501 | 29 | 29 | ||
502 | 30 | # The Launchpad production environment selects Expat at present. This | 30 | # The Launchpad production environment selects Expat at present. This |
504 | 31 | # is quite strict compared to the other parsers that xmlrpc_client | 31 | # is quite strict compared to the other parsers that xmlrpc.client |
505 | 32 | # can possibly select. | 32 | # can possibly select. |
506 | 33 | ensure_response_parser_is_expat(transport) | 33 | ensure_response_parser_is_expat(transport) |
507 | 34 | 34 | ||
508 | diff --git a/lib/lp/bugs/externalbugtracker/trac.py b/lib/lp/bugs/externalbugtracker/trac.py | |||
509 | index 9a2e0a3..9d67e1f 100644 | |||
510 | --- a/lib/lp/bugs/externalbugtracker/trac.py | |||
511 | +++ b/lib/lp/bugs/externalbugtracker/trac.py | |||
512 | @@ -10,11 +10,11 @@ import csv | |||
513 | 10 | from datetime import datetime | 10 | from datetime import datetime |
514 | 11 | from email.utils import parseaddr | 11 | from email.utils import parseaddr |
515 | 12 | import time | 12 | import time |
516 | 13 | import xmlrpc.client | ||
517 | 13 | 14 | ||
518 | 14 | import pytz | 15 | import pytz |
519 | 15 | import requests | 16 | import requests |
520 | 16 | from requests.cookies import RequestsCookieJar | 17 | from requests.cookies import RequestsCookieJar |
521 | 17 | from six.moves import xmlrpc_client | ||
522 | 18 | from zope.component import getUtility | 18 | from zope.component import getUtility |
523 | 19 | from zope.interface import implementer | 19 | from zope.interface import implementer |
524 | 20 | 20 | ||
525 | @@ -305,14 +305,14 @@ class Trac(ExternalBugTracker): | |||
526 | 305 | def needs_authentication(func): | 305 | def needs_authentication(func): |
527 | 306 | """Decorator for automatically authenticating if needed. | 306 | """Decorator for automatically authenticating if needed. |
528 | 307 | 307 | ||
530 | 308 | If an `xmlrpc_client.ProtocolError` with error code 403 is raised by the | 308 | If an `xmlrpc.client.ProtocolError` with error code 403 is raised by the |
531 | 309 | function, we'll try to authenticate and call the function again. | 309 | function, we'll try to authenticate and call the function again. |
532 | 310 | """ | 310 | """ |
533 | 311 | 311 | ||
534 | 312 | def decorator(self, *args, **kwargs): | 312 | def decorator(self, *args, **kwargs): |
535 | 313 | try: | 313 | try: |
536 | 314 | return func(self, *args, **kwargs) | 314 | return func(self, *args, **kwargs) |
538 | 315 | except xmlrpc_client.ProtocolError as error: | 315 | except xmlrpc.client.ProtocolError as error: |
539 | 316 | # Catch authentication errors only. | 316 | # Catch authentication errors only. |
540 | 317 | if error.errcode != 403: | 317 | if error.errcode != 403: |
541 | 318 | raise | 318 | raise |
542 | @@ -340,7 +340,7 @@ class TracLPPlugin(Trac): | |||
543 | 340 | self._internal_xmlrpc_transport = internal_xmlrpc_transport | 340 | self._internal_xmlrpc_transport = internal_xmlrpc_transport |
544 | 341 | 341 | ||
545 | 342 | xmlrpc_endpoint = urlappend(self.baseurl, 'xmlrpc') | 342 | xmlrpc_endpoint = urlappend(self.baseurl, 'xmlrpc') |
547 | 343 | self._server = xmlrpc_client.ServerProxy( | 343 | self._server = xmlrpc.client.ServerProxy( |
548 | 344 | xmlrpc_endpoint, transport=self._xmlrpc_transport) | 344 | xmlrpc_endpoint, transport=self._xmlrpc_transport) |
549 | 345 | 345 | ||
550 | 346 | def makeRequest(self, method, url, **kwargs): | 346 | def makeRequest(self, method, url, **kwargs): |
551 | @@ -365,7 +365,7 @@ class TracLPPlugin(Trac): | |||
552 | 365 | @ensure_no_transaction | 365 | @ensure_no_transaction |
553 | 366 | def _generateAuthenticationToken(self): | 366 | def _generateAuthenticationToken(self): |
554 | 367 | """Create an authentication token and return it.""" | 367 | """Create an authentication token and return it.""" |
556 | 368 | internal_xmlrpc = xmlrpc_client.ServerProxy( | 368 | internal_xmlrpc = xmlrpc.client.ServerProxy( |
557 | 369 | config.checkwatches.xmlrpc_url, | 369 | config.checkwatches.xmlrpc_url, |
558 | 370 | transport=self._internal_xmlrpc_transport) | 370 | transport=self._internal_xmlrpc_transport) |
559 | 371 | return internal_xmlrpc.newBugTrackerToken() | 371 | return internal_xmlrpc.newBugTrackerToken() |
560 | @@ -491,7 +491,7 @@ class TracLPPlugin(Trac): | |||
561 | 491 | try: | 491 | try: |
562 | 492 | timestamp, lp_bug_id = self._server.launchpad.get_launchpad_bug( | 492 | timestamp, lp_bug_id = self._server.launchpad.get_launchpad_bug( |
563 | 493 | remote_bug) | 493 | remote_bug) |
565 | 494 | except xmlrpc_client.Fault as fault: | 494 | except xmlrpc.client.Fault as fault: |
566 | 495 | # Deal with "Ticket does not exist" faults. We re-raise | 495 | # Deal with "Ticket does not exist" faults. We re-raise |
567 | 496 | # anything else, since they're a sign of a bigger problem. | 496 | # anything else, since they're a sign of a bigger problem. |
568 | 497 | if fault.faultCode == FAULT_TICKET_NOT_FOUND: | 497 | if fault.faultCode == FAULT_TICKET_NOT_FOUND: |
569 | @@ -522,7 +522,7 @@ class TracLPPlugin(Trac): | |||
570 | 522 | try: | 522 | try: |
571 | 523 | self._server.launchpad.set_launchpad_bug( | 523 | self._server.launchpad.set_launchpad_bug( |
572 | 524 | remote_bug, launchpad_bug_id) | 524 | remote_bug, launchpad_bug_id) |
574 | 525 | except xmlrpc_client.Fault as fault: | 525 | except xmlrpc.client.Fault as fault: |
575 | 526 | # Deal with "Ticket does not exist" faults. We re-raise | 526 | # Deal with "Ticket does not exist" faults. We re-raise |
576 | 527 | # anything else, since they're a sign of a bigger problem. | 527 | # anything else, since they're a sign of a bigger problem. |
577 | 528 | if fault.faultCode == FAULT_TICKET_NOT_FOUND: | 528 | if fault.faultCode == FAULT_TICKET_NOT_FOUND: |
578 | diff --git a/lib/lp/bugs/externalbugtracker/xmlrpc.py b/lib/lp/bugs/externalbugtracker/xmlrpc.py | |||
579 | index b263982..6d63fe9 100644 | |||
580 | --- a/lib/lp/bugs/externalbugtracker/xmlrpc.py | |||
581 | +++ b/lib/lp/bugs/externalbugtracker/xmlrpc.py | |||
582 | @@ -9,6 +9,10 @@ __all__ = [ | |||
583 | 9 | 9 | ||
584 | 10 | 10 | ||
585 | 11 | from io import BytesIO | 11 | from io import BytesIO |
586 | 12 | from xmlrpc.client import ( | ||
587 | 13 | ProtocolError, | ||
588 | 14 | Transport, | ||
589 | 15 | ) | ||
590 | 12 | 16 | ||
591 | 13 | from defusedxml.xmlrpc import monkey_patch | 17 | from defusedxml.xmlrpc import monkey_patch |
592 | 14 | import requests | 18 | import requests |
593 | @@ -18,10 +22,6 @@ from six.moves.urllib.parse import ( | |||
594 | 18 | urlparse, | 22 | urlparse, |
595 | 19 | urlunparse, | 23 | urlunparse, |
596 | 20 | ) | 24 | ) |
597 | 21 | from six.moves.xmlrpc_client import ( | ||
598 | 22 | ProtocolError, | ||
599 | 23 | Transport, | ||
600 | 24 | ) | ||
601 | 25 | 25 | ||
602 | 26 | from lp.bugs.externalbugtracker.base import repost_on_redirect_hook | 26 | from lp.bugs.externalbugtracker.base import repost_on_redirect_hook |
603 | 27 | from lp.services.config import config | 27 | from lp.services.config import config |
604 | diff --git a/lib/lp/bugs/scripts/checkwatches/core.py b/lib/lp/bugs/scripts/checkwatches/core.py | |||
605 | index 3540182..c659a77 100644 | |||
606 | --- a/lib/lp/bugs/scripts/checkwatches/core.py | |||
607 | +++ b/lib/lp/bugs/scripts/checkwatches/core.py | |||
608 | @@ -27,10 +27,10 @@ import socket | |||
609 | 27 | import sys | 27 | import sys |
610 | 28 | import threading | 28 | import threading |
611 | 29 | import time | 29 | import time |
612 | 30 | from xmlrpc.client import ProtocolError | ||
613 | 30 | 31 | ||
614 | 31 | import pytz | 32 | import pytz |
615 | 32 | import six | 33 | import six |
616 | 33 | from six.moves.xmlrpc_client import ProtocolError | ||
617 | 34 | from twisted.internet import reactor | 34 | from twisted.internet import reactor |
618 | 35 | from twisted.internet.defer import DeferredList | 35 | from twisted.internet.defer import DeferredList |
619 | 36 | from twisted.internet.threads import deferToThreadPool | 36 | from twisted.internet.threads import deferToThreadPool |
620 | diff --git a/lib/lp/bugs/scripts/checkwatches/tests/test_core.py b/lib/lp/bugs/scripts/checkwatches/tests/test_core.py | |||
621 | index 27be1c9..f127aff 100644 | |||
622 | --- a/lib/lp/bugs/scripts/checkwatches/tests/test_core.py | |||
623 | +++ b/lib/lp/bugs/scripts/checkwatches/tests/test_core.py | |||
624 | @@ -5,8 +5,8 @@ | |||
625 | 5 | from datetime import datetime | 5 | from datetime import datetime |
626 | 6 | import threading | 6 | import threading |
627 | 7 | import unittest | 7 | import unittest |
628 | 8 | from xmlrpc.client import ProtocolError | ||
629 | 8 | 9 | ||
630 | 9 | from six.moves.xmlrpc_client import ProtocolError | ||
631 | 10 | import transaction | 10 | import transaction |
632 | 11 | from zope.component import getUtility | 11 | from zope.component import getUtility |
633 | 12 | 12 | ||
634 | diff --git a/lib/lp/bugs/scripts/checkwatches/utilities.py b/lib/lp/bugs/scripts/checkwatches/utilities.py | |||
635 | index c06207e..9c7ac94 100644 | |||
636 | --- a/lib/lp/bugs/scripts/checkwatches/utilities.py | |||
637 | +++ b/lib/lp/bugs/scripts/checkwatches/utilities.py | |||
638 | @@ -9,8 +9,7 @@ __all__ = [ | |||
639 | 9 | ] | 9 | ] |
640 | 10 | 10 | ||
641 | 11 | import socket | 11 | import socket |
644 | 12 | 12 | from xmlrpc.client import ProtocolError | |
643 | 13 | from six.moves.xmlrpc_client import ProtocolError | ||
645 | 14 | 13 | ||
646 | 15 | from lp.bugs.externalbugtracker import ( | 14 | from lp.bugs.externalbugtracker import ( |
647 | 16 | BugNotFound, | 15 | BugNotFound, |
648 | diff --git a/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt b/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt | |||
649 | index 7d7561c..abab32e 100644 | |||
650 | --- a/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt | |||
651 | +++ b/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt | |||
652 | @@ -5,9 +5,9 @@ Launchpad can generate LoginTokens which can then be used to | |||
653 | 5 | authenticate it with remote bug trackers. Generating these tokens is | 5 | authenticate it with remote bug trackers. Generating these tokens is |
654 | 6 | done using the internal XML-RPC service. | 6 | done using the internal XML-RPC service. |
655 | 7 | 7 | ||
657 | 8 | >>> from six.moves import xmlrpc_client | 8 | >>> import xmlrpc.client |
658 | 9 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport | 9 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
660 | 10 | >>> bugtracker_api = xmlrpc_client.ServerProxy( | 10 | >>> bugtracker_api = xmlrpc.client.ServerProxy( |
661 | 11 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', | 11 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', |
662 | 12 | ... transport=XMLRPCTestTransport()) | 12 | ... transport=XMLRPCTestTransport()) |
663 | 13 | 13 | ||
664 | diff --git a/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt b/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt | |||
665 | index a22d598..185139b 100644 | |||
666 | --- a/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt | |||
667 | +++ b/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt | |||
668 | @@ -9,12 +9,12 @@ very similar to the TestBugzillaXMLRPCTransport, which it subclasses. | |||
669 | 9 | Only the parts of TestBugzillaAPIXMLRPCTransport that are different from | 9 | Only the parts of TestBugzillaAPIXMLRPCTransport that are different from |
670 | 10 | its ancestor will be tested here. | 10 | its ancestor will be tested here. |
671 | 11 | 11 | ||
673 | 12 | >>> from six.moves import xmlrpc_client | 12 | >>> import xmlrpc.client |
674 | 13 | >>> from lp.bugs.tests.externalbugtracker import ( | 13 | >>> from lp.bugs.tests.externalbugtracker import ( |
675 | 14 | ... TestBugzillaAPIXMLRPCTransport) | 14 | ... TestBugzillaAPIXMLRPCTransport) |
676 | 15 | >>> bugzilla_transport = TestBugzillaAPIXMLRPCTransport( | 15 | >>> bugzilla_transport = TestBugzillaAPIXMLRPCTransport( |
677 | 16 | ... 'http://example.com/xmlrpc.cgi') | 16 | ... 'http://example.com/xmlrpc.cgi') |
679 | 17 | >>> server = xmlrpc_client.ServerProxy( | 17 | >>> server = xmlrpc.client.ServerProxy( |
680 | 18 | ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport) | 18 | ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport) |
681 | 19 | 19 | ||
682 | 20 | 20 | ||
683 | diff --git a/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt b/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt | |||
684 | index 445dbc6..d0e385e 100644 | |||
685 | --- a/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt | |||
686 | +++ b/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt | |||
687 | @@ -4,12 +4,12 @@ TestBugzillaXMLRPCTransport | |||
688 | 4 | The TestBugzillaXMLRPCTransport is an XML-RPC transport which simulates | 4 | The TestBugzillaXMLRPCTransport is an XML-RPC transport which simulates |
689 | 5 | a remote Bugzilla instance that implements the Launchpad plugin API. | 5 | a remote Bugzilla instance that implements the Launchpad plugin API. |
690 | 6 | 6 | ||
692 | 7 | >>> from six.moves import xmlrpc_client | 7 | >>> import xmlrpc.client |
693 | 8 | >>> from lp.bugs.tests.externalbugtracker import ( | 8 | >>> from lp.bugs.tests.externalbugtracker import ( |
694 | 9 | ... TestBugzillaXMLRPCTransport) | 9 | ... TestBugzillaXMLRPCTransport) |
695 | 10 | >>> bugzilla_transport = TestBugzillaXMLRPCTransport( | 10 | >>> bugzilla_transport = TestBugzillaXMLRPCTransport( |
696 | 11 | ... 'http://example.com/xmlrpc.cgi') | 11 | ... 'http://example.com/xmlrpc.cgi') |
698 | 12 | >>> server = xmlrpc_client.ServerProxy( | 12 | >>> server = xmlrpc.client.ServerProxy( |
699 | 13 | ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport) | 13 | ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport) |
700 | 14 | 14 | ||
701 | 15 | The test transport will only allow calls to methods in a predefined set | 15 | The test transport will only allow calls to methods in a predefined set |
702 | diff --git a/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt b/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt | |||
703 | index 79fa0b0..de54f39 100644 | |||
704 | --- a/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt | |||
705 | +++ b/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt | |||
706 | @@ -22,13 +22,13 @@ request parameters as an XMLRPC parameter, and sets a cookie from the | |||
707 | 22 | server, 'foo=bar'. | 22 | server, 'foo=bar'. |
708 | 23 | 23 | ||
709 | 24 | >>> import responses | 24 | >>> import responses |
711 | 25 | >>> from six.moves import xmlrpc_client | 25 | >>> import xmlrpc.client |
712 | 26 | 26 | ||
713 | 27 | >>> def test_callback(request): | 27 | >>> def test_callback(request): |
715 | 28 | ... params = xmlrpc_client.loads(request.body)[0] | 28 | ... params = xmlrpc.client.loads(request.body)[0] |
716 | 29 | ... return ( | 29 | ... return ( |
717 | 30 | ... 200, {'Set-Cookie': 'foo=bar'}, | 30 | ... 200, {'Set-Cookie': 'foo=bar'}, |
719 | 31 | ... xmlrpc_client.dumps( | 31 | ... xmlrpc.client.dumps( |
720 | 32 | ... ([request.url] + list(params),), methodresponse=True)) | 32 | ... ([request.url] + list(params),), methodresponse=True)) |
721 | 33 | 33 | ||
722 | 34 | Before sending the request, the transport's cookie jar is empty. | 34 | Before sending the request, the transport's cookie jar is empty. |
723 | @@ -71,7 +71,7 @@ In addition to cookies sent by the server, we can set cookies locally. | |||
724 | 71 | foo=bar | 71 | foo=bar |
725 | 72 | 72 | ||
726 | 73 | If an error occurs trying to make the request, an | 73 | If an error occurs trying to make the request, an |
728 | 74 | ``xmlrpc_client.ProtocolError`` is raised. | 74 | ``xmlrpc.client.ProtocolError`` is raised. |
729 | 75 | 75 | ||
730 | 76 | >>> request_body = """<?xml version="1.0"?> | 76 | >>> request_body = """<?xml version="1.0"?> |
731 | 77 | ... <methodCall> | 77 | ... <methodCall> |
732 | diff --git a/lib/lp/bugs/tests/externalbugtracker.py b/lib/lp/bugs/tests/externalbugtracker.py | |||
733 | index a6b3ea4..cdce45f 100644 | |||
734 | --- a/lib/lp/bugs/tests/externalbugtracker.py | |||
735 | +++ b/lib/lp/bugs/tests/externalbugtracker.py | |||
736 | @@ -14,10 +14,10 @@ import os | |||
737 | 14 | import random | 14 | import random |
738 | 15 | import re | 15 | import re |
739 | 16 | import time | 16 | import time |
740 | 17 | import xmlrpc.client | ||
741 | 17 | 18 | ||
742 | 18 | import responses | 19 | import responses |
743 | 19 | import six | 20 | import six |
744 | 20 | from six.moves import xmlrpc_client | ||
745 | 21 | from six.moves.urllib_parse import ( | 21 | from six.moves.urllib_parse import ( |
746 | 22 | parse_qs, | 22 | parse_qs, |
747 | 23 | urljoin, | 23 | urljoin, |
748 | @@ -564,7 +564,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): | |||
749 | 564 | method on this class with the same name as the XML-RPC method is | 564 | method on this class with the same name as the XML-RPC method is |
750 | 565 | called, with the extracted arguments passed on to it. | 565 | called, with the extracted arguments passed on to it. |
751 | 566 | """ | 566 | """ |
753 | 567 | args, method_name = xmlrpc_client.loads(request) | 567 | args, method_name = xmlrpc.client.loads(request) |
754 | 568 | method_prefix, method_name = method_name.split('.') | 568 | method_prefix, method_name = method_name.split('.') |
755 | 569 | 569 | ||
756 | 570 | assert method_prefix in self.methods, ( | 570 | assert method_prefix in self.methods, ( |
757 | @@ -579,7 +579,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): | |||
758 | 579 | # cookie, throw a Fault. | 579 | # cookie, throw a Fault. |
759 | 580 | if (method_name in self.auth_required_methods and | 580 | if (method_name in self.auth_required_methods and |
760 | 581 | not self.has_valid_auth_cookie): | 581 | not self.has_valid_auth_cookie): |
762 | 582 | raise xmlrpc_client.Fault(410, 'Login Required') | 582 | raise xmlrpc.client.Fault(410, 'Login Required') |
763 | 583 | 583 | ||
764 | 584 | if self.print_method_calls: | 584 | if self.print_method_calls: |
765 | 585 | if len(args) > 0: | 585 | if len(args) > 0: |
766 | @@ -638,7 +638,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): | |||
767 | 638 | self._setAuthCookie() | 638 | self._setAuthCookie() |
768 | 639 | 639 | ||
769 | 640 | # We always return the same user ID. | 640 | # We always return the same user ID. |
771 | 641 | # This has to be listified because xmlrpc_client tries to expand | 641 | # This has to be listified because xmlrpc.client tries to expand |
772 | 642 | # sequences of length 1. | 642 | # sequences of length 1. |
773 | 643 | return [{'user_id': 42}] | 643 | return [{'user_id': 42}] |
774 | 644 | 644 | ||
775 | @@ -762,7 +762,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): | |||
776 | 762 | 762 | ||
777 | 763 | # If the bug doesn't exist, raise a fault. | 763 | # If the bug doesn't exist, raise a fault. |
778 | 764 | if int(bug_id) not in self.bugs: | 764 | if int(bug_id) not in self.bugs: |
780 | 765 | raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id) | 765 | raise xmlrpc.client.Fault(101, "Bug #%s does not exist." % bug_id) |
781 | 766 | 766 | ||
782 | 767 | # If we don't have comments for the bug already, create an empty | 767 | # If we don't have comments for the bug already, create an empty |
783 | 768 | # comment dict. | 768 | # comment dict. |
784 | @@ -790,7 +790,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): | |||
785 | 790 | 790 | ||
786 | 791 | self.comment_id_index = comment_id | 791 | self.comment_id_index = comment_id |
787 | 792 | 792 | ||
789 | 793 | # We have to return a list here because xmlrpc_client will try to | 793 | # We have to return a list here because xmlrpc.client will try to |
790 | 794 | # expand sequences of length 1. Trying to do that on a dict will | 794 | # expand sequences of length 1. Trying to do that on a dict will |
791 | 795 | # cause it to explode. | 795 | # cause it to explode. |
792 | 796 | return [{'comment_id': comment_id}] | 796 | return [{'comment_id': comment_id}] |
793 | @@ -810,7 +810,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): | |||
794 | 810 | old_launchpad_id = bug['internals'].get('launchpad_id', 0) | 810 | old_launchpad_id = bug['internals'].get('launchpad_id', 0) |
795 | 811 | bug['internals']['launchpad_id'] = launchpad_id | 811 | bug['internals']['launchpad_id'] = launchpad_id |
796 | 812 | 812 | ||
798 | 813 | # We need to return a list here because xmlrpc_client will try to | 813 | # We need to return a list here because xmlrpc.client will try to |
799 | 814 | # expand sequences of length 1, which will fail horribly when | 814 | # expand sequences of length 1, which will fail horribly when |
800 | 815 | # the sequence is in fact a dict. | 815 | # the sequence is in fact a dict. |
801 | 816 | return [{'launchpad_id': old_launchpad_id}] | 816 | return [{'launchpad_id': old_launchpad_id}] |
802 | @@ -908,7 +908,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): | |||
803 | 908 | 908 | ||
804 | 909 | def version(self): | 909 | def version(self): |
805 | 910 | """Return the version of Bugzilla being used.""" | 910 | """Return the version of Bugzilla being used.""" |
807 | 911 | # This is to work around the old "xmlrpc_client tries to expand | 911 | # This is to work around the old "xmlrpc.client tries to expand |
808 | 912 | # sequences of length 1" problem (see above). | 912 | # sequences of length 1" problem (see above). |
809 | 913 | return [{'version': '3.4.1+'}] | 913 | return [{'version': '3.4.1+'}] |
810 | 914 | 914 | ||
811 | @@ -924,7 +924,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): | |||
812 | 924 | self._setAuthCookie() | 924 | self._setAuthCookie() |
813 | 925 | return [{'id': self.users.index(user)}] | 925 | return [{'id': self.users.index(user)}] |
814 | 926 | else: | 926 | else: |
816 | 927 | raise xmlrpc_client.Fault( | 927 | raise xmlrpc.client.Fault( |
817 | 928 | 300, | 928 | 300, |
818 | 929 | "The username or password you entered is not valid.") | 929 | "The username or password you entered is not valid.") |
819 | 930 | 930 | ||
820 | @@ -1043,7 +1043,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): | |||
821 | 1043 | 1043 | ||
822 | 1044 | # If the bug doesn't exist, raise a fault. | 1044 | # If the bug doesn't exist, raise a fault. |
823 | 1045 | if int(bug_id) not in self.bugs: | 1045 | if int(bug_id) not in self.bugs: |
825 | 1046 | raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id) | 1046 | raise xmlrpc.client.Fault(101, "Bug #%s does not exist." % bug_id) |
826 | 1047 | 1047 | ||
827 | 1048 | # If we don't have comments for the bug already, create an empty | 1048 | # If we don't have comments for the bug already, create an empty |
828 | 1049 | # comment dict. | 1049 | # comment dict. |
829 | @@ -1072,7 +1072,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): | |||
830 | 1072 | 1072 | ||
831 | 1073 | self.comment_id_index = comment_id | 1073 | self.comment_id_index = comment_id |
832 | 1074 | 1074 | ||
834 | 1075 | # We have to return a list here because xmlrpc_client will try to | 1075 | # We have to return a list here because xmlrpc.client will try to |
835 | 1076 | # expand sequences of length 1. Trying to do that on a dict will | 1076 | # expand sequences of length 1. Trying to do that on a dict will |
836 | 1077 | # cause it to explode. | 1077 | # cause it to explode. |
837 | 1078 | return [{'id': comment_id}] | 1078 | return [{'id': comment_id}] |
838 | @@ -1091,7 +1091,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): | |||
839 | 1091 | 1091 | ||
840 | 1092 | # If the bug ID doesn't exist, raise a Fault. | 1092 | # If the bug ID doesn't exist, raise a Fault. |
841 | 1093 | if bug_id not in self.bugs: | 1093 | if bug_id not in self.bugs: |
843 | 1094 | raise xmlrpc_client.Fault( | 1094 | raise xmlrpc.client.Fault( |
844 | 1095 | 101, "Bug #%s does not exist." % bug_id) | 1095 | 101, "Bug #%s does not exist." % bug_id) |
845 | 1096 | 1096 | ||
846 | 1097 | see_also_list = self.bugs[bug_id].get('see_also', []) | 1097 | see_also_list = self.bugs[bug_id].get('see_also', []) |
847 | @@ -1122,7 +1122,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): | |||
848 | 1122 | 1122 | ||
849 | 1123 | if ('launchpad' not in url and | 1123 | if ('launchpad' not in url and |
850 | 1124 | 'show_bug.cgi' not in url): | 1124 | 'show_bug.cgi' not in url): |
852 | 1125 | raise xmlrpc_client.Fault( | 1125 | raise xmlrpc.client.Fault( |
853 | 1126 | 112, "Bug URL %s is invalid." % url) | 1126 | 112, "Bug URL %s is invalid." % url) |
854 | 1127 | 1127 | ||
855 | 1128 | if changes.get(bug_id) is None: | 1128 | if changes.get(bug_id) is None: |
856 | @@ -1140,7 +1140,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): | |||
857 | 1140 | # Replace the bug's existing see_also list. | 1140 | # Replace the bug's existing see_also list. |
858 | 1141 | self.bugs[bug_id]['see_also'] = see_also_list | 1141 | self.bugs[bug_id]['see_also'] = see_also_list |
859 | 1142 | 1142 | ||
861 | 1143 | # We have to return a list here because xmlrpc_client will try to | 1143 | # We have to return a list here because xmlrpc.client will try to |
862 | 1144 | # expand sequences of length 1. Trying to do that on a dict will | 1144 | # expand sequences of length 1. Trying to do that on a dict will |
863 | 1145 | # cause it to explode. | 1145 | # cause it to explode. |
864 | 1146 | return [{'changes': changes}] | 1146 | return [{'changes': changes}] |
865 | @@ -1267,7 +1267,7 @@ class TestInternalXMLRPCTransport: | |||
866 | 1267 | self.quiet = quiet | 1267 | self.quiet = quiet |
867 | 1268 | 1268 | ||
868 | 1269 | def request(self, host, handler, request, verbose=None): | 1269 | def request(self, host, handler, request, verbose=None): |
870 | 1270 | args, method_name = xmlrpc_client.loads(request) | 1270 | args, method_name = xmlrpc.client.loads(request) |
871 | 1271 | method = getattr(self, method_name) | 1271 | method = getattr(self, method_name) |
872 | 1272 | with lp_dbuser(): | 1272 | with lp_dbuser(): |
873 | 1273 | return method(*args) | 1273 | return method(*args) |
874 | @@ -1327,14 +1327,14 @@ class TestTracXMLRPCTransport(RequestsTransport): | |||
875 | 1327 | """ | 1327 | """ |
876 | 1328 | assert handler.endswith('/xmlrpc'), ( | 1328 | assert handler.endswith('/xmlrpc'), ( |
877 | 1329 | 'The Trac endpoint must end with /xmlrpc') | 1329 | 'The Trac endpoint must end with /xmlrpc') |
879 | 1330 | args, method_name = xmlrpc_client.loads(request) | 1330 | args, method_name = xmlrpc.client.loads(request) |
880 | 1331 | prefix = 'launchpad.' | 1331 | prefix = 'launchpad.' |
881 | 1332 | assert method_name.startswith(prefix), ( | 1332 | assert method_name.startswith(prefix), ( |
882 | 1333 | 'All methods should be in the launchpad namespace') | 1333 | 'All methods should be in the launchpad namespace') |
883 | 1334 | if (self.auth_cookie is None or | 1334 | if (self.auth_cookie is None or |
884 | 1335 | self.auth_cookie == self.expired_cookie): | 1335 | self.auth_cookie == self.expired_cookie): |
885 | 1336 | # All the Trac XML-RPC methods need authentication. | 1336 | # All the Trac XML-RPC methods need authentication. |
887 | 1337 | raise xmlrpc_client.ProtocolError( | 1337 | raise xmlrpc.client.ProtocolError( |
888 | 1338 | method_name, errcode=403, errmsg="Forbidden", | 1338 | method_name, errcode=403, errmsg="Forbidden", |
889 | 1339 | headers=None) | 1339 | headers=None) |
890 | 1340 | 1340 | ||
891 | @@ -1522,7 +1522,7 @@ class TestTracXMLRPCTransport(RequestsTransport): | |||
892 | 1522 | return 0. Otherwise return the mapped Launchpad bug ID. | 1522 | return 0. Otherwise return the mapped Launchpad bug ID. |
893 | 1523 | """ | 1523 | """ |
894 | 1524 | if bugid not in self.remote_bugs: | 1524 | if bugid not in self.remote_bugs: |
896 | 1525 | raise xmlrpc_client.Fault( | 1525 | raise xmlrpc.client.Fault( |
897 | 1526 | FAULT_TICKET_NOT_FOUND, 'Ticket does not exist') | 1526 | FAULT_TICKET_NOT_FOUND, 'Ticket does not exist') |
898 | 1527 | 1527 | ||
899 | 1528 | return [self.utc_time, self.launchpad_bugs.get(bugid, 0)] | 1528 | return [self.utc_time, self.launchpad_bugs.get(bugid, 0)] |
900 | @@ -1536,12 +1536,12 @@ class TestTracXMLRPCTransport(RequestsTransport): | |||
901 | 1536 | Return the current UTC timestamp. | 1536 | Return the current UTC timestamp. |
902 | 1537 | """ | 1537 | """ |
903 | 1538 | if bugid not in self.remote_bugs: | 1538 | if bugid not in self.remote_bugs: |
905 | 1539 | raise xmlrpc_client.Fault( | 1539 | raise xmlrpc.client.Fault( |
906 | 1540 | FAULT_TICKET_NOT_FOUND, 'Ticket does not exist') | 1540 | FAULT_TICKET_NOT_FOUND, 'Ticket does not exist') |
907 | 1541 | 1541 | ||
908 | 1542 | self.launchpad_bugs[bugid] = launchpad_bug | 1542 | self.launchpad_bugs[bugid] = launchpad_bug |
909 | 1543 | 1543 | ||
911 | 1544 | # Return a list, since xmlrpc_client insists on trying to expand | 1544 | # Return a list, since xmlrpc.client insists on trying to expand |
912 | 1545 | # results. | 1545 | # results. |
913 | 1546 | return [self.utc_time] | 1546 | return [self.utc_time] |
914 | 1547 | 1547 | ||
915 | @@ -1698,7 +1698,7 @@ class TestDebBugs(DebBugs): | |||
916 | 1698 | def ensure_response_parser_is_expat(transport): | 1698 | def ensure_response_parser_is_expat(transport): |
917 | 1699 | """Ensure the transport always selects the Expat-based response parser. | 1699 | """Ensure the transport always selects the Expat-based response parser. |
918 | 1700 | 1700 | ||
920 | 1701 | The response parser is chosen by xmlrpc_client at runtime from a number | 1701 | The response parser is chosen by xmlrpc.client at runtime from a number |
921 | 1702 | of choices, but the main Launchpad production environment selects Expat | 1702 | of choices, but the main Launchpad production environment selects Expat |
922 | 1703 | at present. | 1703 | at present. |
923 | 1704 | 1704 | ||
924 | @@ -1707,8 +1707,8 @@ def ensure_response_parser_is_expat(transport): | |||
925 | 1707 | response parsers to be chosen. | 1707 | response parsers to be chosen. |
926 | 1708 | """ | 1708 | """ |
927 | 1709 | def getparser(): | 1709 | def getparser(): |
929 | 1710 | target = xmlrpc_client.Unmarshaller( | 1710 | target = xmlrpc.client.Unmarshaller( |
930 | 1711 | use_datetime=transport._use_datetime) | 1711 | use_datetime=transport._use_datetime) |
932 | 1712 | parser = xmlrpc_client.ExpatParser(target) | 1712 | parser = xmlrpc.client.ExpatParser(target) |
933 | 1713 | return parser, target | 1713 | return parser, target |
934 | 1714 | transport.getparser = getparser | 1714 | transport.getparser = getparser |
935 | diff --git a/lib/lp/bugs/tests/trac-xmlrpc-transport.txt b/lib/lp/bugs/tests/trac-xmlrpc-transport.txt | |||
936 | index 8703cb3..2da5fbb 100644 | |||
937 | --- a/lib/lp/bugs/tests/trac-xmlrpc-transport.txt | |||
938 | +++ b/lib/lp/bugs/tests/trac-xmlrpc-transport.txt | |||
939 | @@ -6,11 +6,11 @@ Trac plugin. It can be used to avoid network traffic while testing, and | |||
940 | 6 | it implements the same API that Trac instances having the LP plugin | 6 | it implements the same API that Trac instances having the LP plugin |
941 | 7 | installed implement. | 7 | installed implement. |
942 | 8 | 8 | ||
944 | 9 | >>> from six.moves import xmlrpc_client | 9 | >>> import xmlrpc.client |
945 | 10 | >>> from lp.bugs.tests.externalbugtracker import ( | 10 | >>> from lp.bugs.tests.externalbugtracker import ( |
946 | 11 | ... TestTracXMLRPCTransport) | 11 | ... TestTracXMLRPCTransport) |
947 | 12 | >>> trac_transport = TestTracXMLRPCTransport('http://example.com/xmlrpc') | 12 | >>> trac_transport = TestTracXMLRPCTransport('http://example.com/xmlrpc') |
949 | 13 | >>> server = xmlrpc_client.ServerProxy( | 13 | >>> server = xmlrpc.client.ServerProxy( |
950 | 14 | ... 'http://example.com/xmlrpc', transport=trac_transport) | 14 | ... 'http://example.com/xmlrpc', transport=trac_transport) |
951 | 15 | 15 | ||
952 | 16 | All the methods need an authentication cookie to be sent. | 16 | All the methods need an authentication cookie to be sent. |
953 | diff --git a/lib/lp/buildmaster/interactor.py b/lib/lp/buildmaster/interactor.py | |||
954 | index 59f7612..796ea92 100644 | |||
955 | --- a/lib/lp/buildmaster/interactor.py | |||
956 | +++ b/lib/lp/buildmaster/interactor.py | |||
957 | @@ -551,7 +551,7 @@ class BuilderInteractor(object): | |||
958 | 551 | if builder_status == "BuilderStatus.ABORTING": | 551 | if builder_status == "BuilderStatus.ABORTING": |
959 | 552 | logtail = u"Waiting for slave process to be terminated" | 552 | logtail = u"Waiting for slave process to be terminated" |
960 | 553 | elif slave_status.get("logtail") is not None: | 553 | elif slave_status.get("logtail") is not None: |
962 | 554 | # slave_status["logtail"] is an xmlrpc_client.Binary instance, | 554 | # slave_status["logtail"] is an xmlrpc.client.Binary instance, |
963 | 555 | # and the contents might include invalid UTF-8 due to being a | 555 | # and the contents might include invalid UTF-8 due to being a |
964 | 556 | # fixed number of bytes from the tail of the log. Turn it into | 556 | # fixed number of bytes from the tail of the log. Turn it into |
965 | 557 | # Unicode as best we can. | 557 | # Unicode as best we can. |
966 | diff --git a/lib/lp/buildmaster/tests/mock_slaves.py b/lib/lp/buildmaster/tests/mock_slaves.py | |||
967 | index df9d0fb..78fa6dc 100644 | |||
968 | --- a/lib/lp/buildmaster/tests/mock_slaves.py | |||
969 | +++ b/lib/lp/buildmaster/tests/mock_slaves.py | |||
970 | @@ -20,11 +20,11 @@ __all__ = [ | |||
971 | 20 | from collections import OrderedDict | 20 | from collections import OrderedDict |
972 | 21 | import os | 21 | import os |
973 | 22 | import sys | 22 | import sys |
974 | 23 | import xmlrpc.client | ||
975 | 23 | 24 | ||
976 | 24 | import fixtures | 25 | import fixtures |
977 | 25 | from lpbuildd.tests.harness import BuilddSlaveTestSetup | 26 | from lpbuildd.tests.harness import BuilddSlaveTestSetup |
978 | 26 | import six | 27 | import six |
979 | 27 | from six.moves import xmlrpc_client | ||
980 | 28 | from testtools.content import attach_file | 28 | from testtools.content import attach_file |
981 | 29 | from twisted.internet import defer | 29 | from twisted.internet import defer |
982 | 30 | from twisted.web import xmlrpc | 30 | from twisted.web import xmlrpc |
983 | @@ -160,7 +160,7 @@ class BuildingSlave(OkSlave): | |||
984 | 160 | 160 | ||
985 | 161 | def status(self): | 161 | def status(self): |
986 | 162 | self.call_log.append('status') | 162 | self.call_log.append('status') |
988 | 163 | buildlog = xmlrpc_client.Binary( | 163 | buildlog = xmlrpc.client.Binary( |
989 | 164 | b"This is a build log: %d" % self.status_count) | 164 | b"This is a build log: %d" % self.status_count) |
990 | 165 | self.status_count += 1 | 165 | self.status_count += 1 |
991 | 166 | return defer.succeed({ | 166 | return defer.succeed({ |
992 | @@ -238,7 +238,7 @@ class AbortingSlave(OkSlave): | |||
993 | 238 | class LostBuildingBrokenSlave: | 238 | class LostBuildingBrokenSlave: |
994 | 239 | """A mock slave building bogus Build/BuildQueue IDs that can't be aborted. | 239 | """A mock slave building bogus Build/BuildQueue IDs that can't be aborted. |
995 | 240 | 240 | ||
997 | 241 | When 'aborted' it raises an xmlrpc_client.Fault(8002, 'Could not abort') | 241 | When 'aborted' it raises an xmlrpc.client.Fault(8002, 'Could not abort') |
998 | 242 | """ | 242 | """ |
999 | 243 | 243 | ||
1000 | 244 | def __init__(self): | 244 | def __init__(self): |
1001 | @@ -253,7 +253,7 @@ class LostBuildingBrokenSlave: | |||
1002 | 253 | 253 | ||
1003 | 254 | def abort(self): | 254 | def abort(self): |
1004 | 255 | self.call_log.append('abort') | 255 | self.call_log.append('abort') |
1006 | 256 | return defer.fail(xmlrpc_client.Fault(8002, "Could not abort")) | 256 | return defer.fail(xmlrpc.client.Fault(8002, "Could not abort")) |
1007 | 257 | 257 | ||
1008 | 258 | def resume(self): | 258 | def resume(self): |
1009 | 259 | self.call_log.append('resume') | 259 | self.call_log.append('resume') |
1010 | @@ -268,7 +268,7 @@ class BrokenSlave: | |||
1011 | 268 | 268 | ||
1012 | 269 | def status(self): | 269 | def status(self): |
1013 | 270 | self.call_log.append('status') | 270 | self.call_log.append('status') |
1015 | 271 | return defer.fail(xmlrpc_client.Fault(8001, "Broken slave")) | 271 | return defer.fail(xmlrpc.client.Fault(8001, "Broken slave")) |
1016 | 272 | 272 | ||
1017 | 273 | 273 | ||
1018 | 274 | class TrivialBehaviour: | 274 | class TrivialBehaviour: |
1019 | diff --git a/lib/lp/buildmaster/tests/test_interactor.py b/lib/lp/buildmaster/tests/test_interactor.py | |||
1020 | index 19572f2..013ab32 100644 | |||
1021 | --- a/lib/lp/buildmaster/tests/test_interactor.py | |||
1022 | +++ b/lib/lp/buildmaster/tests/test_interactor.py | |||
1023 | @@ -12,10 +12,10 @@ import hashlib | |||
1024 | 12 | import os | 12 | import os |
1025 | 13 | import signal | 13 | import signal |
1026 | 14 | import tempfile | 14 | import tempfile |
1027 | 15 | import xmlrpc.client | ||
1028 | 15 | 16 | ||
1029 | 16 | from lpbuildd.builder import BuilderStatus | 17 | from lpbuildd.builder import BuilderStatus |
1030 | 17 | import six | 18 | import six |
1031 | 18 | from six.moves import xmlrpc_client | ||
1032 | 19 | from testtools.matchers import ContainsAll | 19 | from testtools.matchers import ContainsAll |
1033 | 20 | from testtools.testcase import ExpectedException | 20 | from testtools.testcase import ExpectedException |
1034 | 21 | from testtools.twistedsupport import ( | 21 | from testtools.twistedsupport import ( |
1035 | @@ -291,7 +291,7 @@ class TestBuilderInteractorCleanSlave(TestCase): | |||
1036 | 291 | try: | 291 | try: |
1037 | 292 | yield BuilderInteractor.cleanSlave( | 292 | yield BuilderInteractor.cleanSlave( |
1038 | 293 | vitals, slave, MockBuilderFactory(builder, None)) | 293 | vitals, slave, MockBuilderFactory(builder, None)) |
1040 | 294 | except xmlrpc_client.Fault: | 294 | except xmlrpc.client.Fault: |
1041 | 295 | self.assertEqual(['status', 'abort'], slave.call_log) | 295 | self.assertEqual(['status', 'abort'], slave.call_log) |
1042 | 296 | else: | 296 | else: |
1043 | 297 | self.fail("abort() should crash.") | 297 | self.fail("abort() should crash.") |
1044 | @@ -325,7 +325,7 @@ class TestBuilderSlaveStatus(TestCase): | |||
1045 | 325 | del status["build_id"] | 325 | del status["build_id"] |
1046 | 326 | if logtail: | 326 | if logtail: |
1047 | 327 | tail = status.pop("logtail") | 327 | tail = status.pop("logtail") |
1049 | 328 | self.assertIsInstance(tail, xmlrpc_client.Binary) | 328 | self.assertIsInstance(tail, xmlrpc.client.Binary) |
1050 | 329 | 329 | ||
1051 | 330 | self.assertEqual(expected, status) | 330 | self.assertEqual(expected, status) |
1052 | 331 | 331 | ||
1053 | @@ -584,7 +584,7 @@ class TestSlave(TestCase): | |||
1054 | 584 | status = yield slave.status() | 584 | status = yield slave.status() |
1055 | 585 | self.assertEqual(BuilderStatus.BUILDING, status['builder_status']) | 585 | self.assertEqual(BuilderStatus.BUILDING, status['builder_status']) |
1056 | 586 | self.assertEqual(build_id, status['build_id']) | 586 | self.assertEqual(build_id, status['build_id']) |
1058 | 587 | self.assertIsInstance(status['logtail'], xmlrpc_client.Binary) | 587 | self.assertIsInstance(status['logtail'], xmlrpc.client.Binary) |
1059 | 588 | 588 | ||
1060 | 589 | @defer.inlineCallbacks | 589 | @defer.inlineCallbacks |
1061 | 590 | def test_ensurepresent_not_there(self): | 590 | def test_ensurepresent_not_there(self): |
1062 | diff --git a/lib/lp/buildmaster/tests/test_manager.py b/lib/lp/buildmaster/tests/test_manager.py | |||
1063 | index 0187dc2..fd84f13 100644 | |||
1064 | --- a/lib/lp/buildmaster/tests/test_manager.py | |||
1065 | +++ b/lib/lp/buildmaster/tests/test_manager.py | |||
1066 | @@ -11,9 +11,9 @@ import os | |||
1067 | 11 | import signal | 11 | import signal |
1068 | 12 | import time | 12 | import time |
1069 | 13 | from unittest import mock | 13 | from unittest import mock |
1070 | 14 | import xmlrpc.client | ||
1071 | 14 | 15 | ||
1072 | 15 | import six | 16 | import six |
1073 | 16 | from six.moves import xmlrpc_client | ||
1074 | 17 | from testtools.matchers import Equals | 17 | from testtools.matchers import Equals |
1075 | 18 | from testtools.testcase import ExpectedException | 18 | from testtools.testcase import ExpectedException |
1076 | 19 | from testtools.twistedsupport import AsynchronousDeferredRunTest | 19 | from testtools.twistedsupport import AsynchronousDeferredRunTest |
1077 | @@ -308,7 +308,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): | |||
1078 | 308 | builder.failure_count = 0 | 308 | builder.failure_count = 0 |
1079 | 309 | transaction.commit() | 309 | transaction.commit() |
1080 | 310 | scanner = self._getScanner(builder_name=builder.name) | 310 | scanner = self._getScanner(builder_name=builder.name) |
1082 | 311 | with ExpectedException(xmlrpc_client.Fault): | 311 | with ExpectedException(xmlrpc.client.Fault): |
1083 | 312 | yield scanner.scan() | 312 | yield scanner.scan() |
1084 | 313 | 313 | ||
1085 | 314 | @defer.inlineCallbacks | 314 | @defer.inlineCallbacks |
1086 | @@ -319,7 +319,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): | |||
1087 | 319 | @defer.inlineCallbacks | 319 | @defer.inlineCallbacks |
1088 | 320 | def status(self): | 320 | def status(self): |
1089 | 321 | status = yield super(BrokenUTF8Slave, self).status() | 321 | status = yield super(BrokenUTF8Slave, self).status() |
1091 | 322 | status["logtail"] = xmlrpc_client.Binary( | 322 | status["logtail"] = xmlrpc.client.Binary( |
1092 | 323 | u"───".encode("UTF-8")[1:]) | 323 | u"───".encode("UTF-8")[1:]) |
1093 | 324 | return status | 324 | return status |
1094 | 325 | 325 | ||
1095 | @@ -349,7 +349,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): | |||
1096 | 349 | @defer.inlineCallbacks | 349 | @defer.inlineCallbacks |
1097 | 350 | def status(self): | 350 | def status(self): |
1098 | 351 | status = yield super(NULSlave, self).status() | 351 | status = yield super(NULSlave, self).status() |
1100 | 352 | status["logtail"] = xmlrpc_client.Binary(b"foo\0bar\0baz") | 352 | status["logtail"] = xmlrpc.client.Binary(b"foo\0bar\0baz") |
1101 | 353 | return status | 353 | return status |
1102 | 354 | 354 | ||
1103 | 355 | builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME] | 355 | builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME] |
1104 | @@ -1196,7 +1196,7 @@ class TestCancellationChecking(TestCaseWithFactory): | |||
1105 | 1196 | slave = LostBuildingBrokenSlave() | 1196 | slave = LostBuildingBrokenSlave() |
1106 | 1197 | self.builder.current_build.cancel() | 1197 | self.builder.current_build.cancel() |
1107 | 1198 | with ExpectedException( | 1198 | with ExpectedException( |
1109 | 1199 | xmlrpc_client.Fault, "<Fault 8002: %r>" % 'Could not abort'): | 1199 | xmlrpc.client.Fault, "<Fault 8002: %r>" % 'Could not abort'): |
1110 | 1200 | yield self._getScanner().checkCancellation(self.vitals, slave) | 1200 | yield self._getScanner().checkCancellation(self.vitals, slave) |
1111 | 1201 | 1201 | ||
1112 | 1202 | 1202 | ||
1113 | diff --git a/lib/lp/code/doc/branch-xmlrpc.txt b/lib/lp/code/doc/branch-xmlrpc.txt | |||
1114 | index ba2981b..80e782b 100644 | |||
1115 | --- a/lib/lp/code/doc/branch-xmlrpc.txt | |||
1116 | +++ b/lib/lp/code/doc/branch-xmlrpc.txt | |||
1117 | @@ -1,7 +1,7 @@ | |||
1118 | 1 | IPublicCodehostingAPI | 1 | IPublicCodehostingAPI |
1119 | 2 | ===================== | 2 | ===================== |
1120 | 3 | 3 | ||
1122 | 4 | >>> from six.moves import xmlrpc_client | 4 | >>> import xmlrpc.client |
1123 | 5 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport | 5 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
1124 | 6 | 6 | ||
1125 | 7 | 7 | ||
1126 | @@ -17,7 +17,7 @@ Bazaar is strictly unsupported. | |||
1127 | 17 | This API is deprecated, and will eventually be replaced with an | 17 | This API is deprecated, and will eventually be replaced with an |
1128 | 18 | equivalent method in the new Launchpad API infrastructure. | 18 | equivalent method in the new Launchpad API infrastructure. |
1129 | 19 | 19 | ||
1131 | 20 | >>> public_codehosting_api = xmlrpc_client.ServerProxy( | 20 | >>> public_codehosting_api = xmlrpc.client.ServerProxy( |
1132 | 21 | ... 'http://xmlrpc.launchpad.test/bazaar/', | 21 | ... 'http://xmlrpc.launchpad.test/bazaar/', |
1133 | 22 | ... transport=XMLRPCTestTransport()) | 22 | ... transport=XMLRPCTestTransport()) |
1134 | 23 | 23 | ||
1135 | diff --git a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt | |||
1136 | index e60b0d7..ba4b363 100644 | |||
1137 | --- a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt | |||
1138 | +++ b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt | |||
1139 | @@ -42,9 +42,9 @@ can be found in the tests for ICodeImportJobSet. | |||
1140 | 42 | 42 | ||
1141 | 43 | The point of all this is for it to be accessed over XMLRPC. | 43 | The point of all this is for it to be accessed over XMLRPC. |
1142 | 44 | 44 | ||
1144 | 45 | >>> from six.moves import xmlrpc_client | 45 | >>> import xmlrpc.client |
1145 | 46 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport | 46 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
1147 | 47 | >>> codeimportscheduler = xmlrpc_client.ServerProxy( | 47 | >>> codeimportscheduler = xmlrpc.client.ServerProxy( |
1148 | 48 | ... 'http://xmlrpc-private.launchpad.test:8087/codeimportscheduler', | 48 | ... 'http://xmlrpc-private.launchpad.test:8087/codeimportscheduler', |
1149 | 49 | ... transport=XMLRPCTestTransport()) | 49 | ... transport=XMLRPCTestTransport()) |
1150 | 50 | >>> codeimportscheduler.getJobForMachine('bazaar-importer', 2) | 50 | >>> codeimportscheduler.getJobForMachine('bazaar-importer', 2) |
1151 | diff --git a/lib/lp/code/interfaces/codeimportscheduler.py b/lib/lp/code/interfaces/codeimportscheduler.py | |||
1152 | index 47d2b3c..ea1a095 100644 | |||
1153 | --- a/lib/lp/code/interfaces/codeimportscheduler.py | |||
1154 | +++ b/lib/lp/code/interfaces/codeimportscheduler.py | |||
1155 | @@ -59,8 +59,8 @@ class ICodeImportScheduler(Interface): | |||
1156 | 59 | :param job_id: The ID of the code import job to finish. | 59 | :param job_id: The ID of the code import job to finish. |
1157 | 60 | :param status_name: The outcome of the job as the name of a | 60 | :param status_name: The outcome of the job as the name of a |
1158 | 61 | `CodeImportResultStatus` item. | 61 | `CodeImportResultStatus` item. |
1161 | 62 | :param log_file: A log file to display for diagnostics, either as a | 62 | :param log_file: A log file to display for diagnostics, either as an |
1162 | 63 | `six.moves.xmlrpc_client.Binary` containing the log file data or | 63 | `xmlrpc.client.Binary` containing the log file data or |
1163 | 64 | as the URL of a file in the librarian. | 64 | as the URL of a file in the librarian. |
1164 | 65 | :raise NoSuchCodeImportJob: if no job with id `job_id` exists. | 65 | :raise NoSuchCodeImportJob: if no job with id `job_id` exists. |
1165 | 66 | """ | 66 | """ |
1166 | diff --git a/lib/lp/code/xmlrpc/branch.py b/lib/lp/code/xmlrpc/branch.py | |||
1167 | index 235e23e..4833639 100644 | |||
1168 | --- a/lib/lp/code/xmlrpc/branch.py | |||
1169 | +++ b/lib/lp/code/xmlrpc/branch.py | |||
1170 | @@ -8,9 +8,9 @@ __all__ = [ | |||
1171 | 8 | 'PublicCodehostingAPI', | 8 | 'PublicCodehostingAPI', |
1172 | 9 | ] | 9 | ] |
1173 | 10 | 10 | ||
1174 | 11 | from xmlrpc.client import Fault | ||
1175 | 11 | 12 | ||
1176 | 12 | from breezy import urlutils | 13 | from breezy import urlutils |
1177 | 13 | from six.moves.xmlrpc_client import Fault | ||
1178 | 14 | from zope.component import getUtility | 14 | from zope.component import getUtility |
1179 | 15 | from zope.interface import ( | 15 | from zope.interface import ( |
1180 | 16 | implementer, | 16 | implementer, |
1181 | diff --git a/lib/lp/code/xmlrpc/codeimportscheduler.py b/lib/lp/code/xmlrpc/codeimportscheduler.py | |||
1182 | index 0641af4..966b271 100644 | |||
1183 | --- a/lib/lp/code/xmlrpc/codeimportscheduler.py | |||
1184 | +++ b/lib/lp/code/xmlrpc/codeimportscheduler.py | |||
1185 | @@ -8,9 +8,9 @@ __all__ = [ | |||
1186 | 8 | ] | 8 | ] |
1187 | 9 | 9 | ||
1188 | 10 | import io | 10 | import io |
1189 | 11 | import xmlrpc.client | ||
1190 | 11 | 12 | ||
1191 | 12 | import six | 13 | import six |
1192 | 13 | from six.moves import xmlrpc_client | ||
1193 | 14 | from zope.component import getUtility | 14 | from zope.component import getUtility |
1194 | 15 | from zope.interface import implementer | 15 | from zope.interface import implementer |
1195 | 16 | from zope.security.proxy import removeSecurityProxy | 16 | from zope.security.proxy import removeSecurityProxy |
1196 | @@ -92,7 +92,7 @@ class CodeImportSchedulerAPI(LaunchpadXMLRPCView): | |||
1197 | 92 | job = self._getJob(job_id) | 92 | job = self._getJob(job_id) |
1198 | 93 | status = CodeImportResultStatus.items[status_name] | 93 | status = CodeImportResultStatus.items[status_name] |
1199 | 94 | workflow = removeSecurityProxy(getUtility(ICodeImportJobWorkflow)) | 94 | workflow = removeSecurityProxy(getUtility(ICodeImportJobWorkflow)) |
1201 | 95 | if isinstance(log_file, xmlrpc_client.Binary): | 95 | if isinstance(log_file, xmlrpc.client.Binary): |
1202 | 96 | if log_file.data: | 96 | if log_file.data: |
1203 | 97 | log_file_name = '%s.log' % ( | 97 | log_file_name = '%s.log' % ( |
1204 | 98 | job.code_import.target.unique_name[1:].replace('/', '-')) | 98 | job.code_import.target.unique_name[1:].replace('/', '-')) |
1205 | diff --git a/lib/lp/code/xmlrpc/git.py b/lib/lp/code/xmlrpc/git.py | |||
1206 | index b73df08..c7940f0 100644 | |||
1207 | --- a/lib/lp/code/xmlrpc/git.py | |||
1208 | +++ b/lib/lp/code/xmlrpc/git.py | |||
1209 | @@ -10,10 +10,10 @@ __all__ = [ | |||
1210 | 10 | import logging | 10 | import logging |
1211 | 11 | import sys | 11 | import sys |
1212 | 12 | import uuid | 12 | import uuid |
1213 | 13 | import xmlrpc.client | ||
1214 | 13 | 14 | ||
1215 | 14 | from pymacaroons import Macaroon | 15 | from pymacaroons import Macaroon |
1216 | 15 | import six | 16 | import six |
1217 | 16 | from six.moves import xmlrpc_client | ||
1218 | 17 | from six.moves.urllib.parse import quote | 17 | from six.moves.urllib.parse import quote |
1219 | 18 | import transaction | 18 | import transaction |
1220 | 19 | from zope.component import ( | 19 | from zope.component import ( |
1221 | @@ -454,7 +454,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1222 | 454 | requester_id, self._translatePath, | 454 | requester_id, self._translatePath, |
1223 | 455 | six.ensure_text(path).strip("/"), permission, auth_params) | 455 | six.ensure_text(path).strip("/"), permission, auth_params) |
1224 | 456 | try: | 456 | try: |
1226 | 457 | if isinstance(result, xmlrpc_client.Fault): | 457 | if isinstance(result, xmlrpc.client.Fault): |
1227 | 458 | logger.error("translatePath failed: %r", result) | 458 | logger.error("translatePath failed: %r", result) |
1228 | 459 | else: | 459 | else: |
1229 | 460 | # The results of path translation are not sensitive for | 460 | # The results of path translation are not sensitive for |
1230 | @@ -502,7 +502,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1231 | 502 | requester_id, self._notify, | 502 | requester_id, self._notify, |
1232 | 503 | translated_path, statistics, auth_params) | 503 | translated_path, statistics, auth_params) |
1233 | 504 | try: | 504 | try: |
1235 | 505 | if isinstance(result, xmlrpc_client.Fault): | 505 | if isinstance(result, xmlrpc.client.Fault): |
1236 | 506 | logger.error("notify failed: %r", result) | 506 | logger.error("notify failed: %r", result) |
1237 | 507 | else: | 507 | else: |
1238 | 508 | logger.info("notify succeeded: %s" % result) | 508 | logger.info("notify succeeded: %s" % result) |
1239 | @@ -544,7 +544,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1240 | 544 | requester_id, self._getMergeProposalURL, | 544 | requester_id, self._getMergeProposalURL, |
1241 | 545 | translated_path, branch, auth_params) | 545 | translated_path, branch, auth_params) |
1242 | 546 | try: | 546 | try: |
1244 | 547 | if isinstance(result, xmlrpc_client.Fault): | 547 | if isinstance(result, xmlrpc.client.Fault): |
1245 | 548 | logger.error("getMergeProposalURL failed: %r", result) | 548 | logger.error("getMergeProposalURL failed: %r", result) |
1246 | 549 | else: | 549 | else: |
1247 | 550 | # The result of getMergeProposalURL is not sensitive for | 550 | # The result of getMergeProposalURL is not sensitive for |
1248 | @@ -586,7 +586,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1249 | 586 | "Request received: authenticateWithPassword('%s')", username) | 586 | "Request received: authenticateWithPassword('%s')", username) |
1250 | 587 | result = self._authenticateWithPassword(username, password) | 587 | result = self._authenticateWithPassword(username, password) |
1251 | 588 | try: | 588 | try: |
1253 | 589 | if isinstance(result, xmlrpc_client.Fault): | 589 | if isinstance(result, xmlrpc.client.Fault): |
1254 | 590 | logger.error("authenticateWithPassword failed: %r", result) | 590 | logger.error("authenticateWithPassword failed: %r", result) |
1255 | 591 | else: | 591 | else: |
1256 | 592 | # The results of authentication may be sensitive, but we can | 592 | # The results of authentication may be sensitive, but we can |
1257 | @@ -640,7 +640,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1258 | 640 | # the moment. It's possible to reach this by being very unlucky | 640 | # the moment. It's possible to reach this by being very unlucky |
1259 | 641 | # about the timing of a push. | 641 | # about the timing of a push. |
1260 | 642 | return [ | 642 | return [ |
1262 | 643 | (xmlrpc_client.Binary(ref_path.data), []) | 643 | (xmlrpc.client.Binary(ref_path.data), []) |
1263 | 644 | for ref_path in ref_paths] | 644 | for ref_path in ref_paths] |
1264 | 645 | 645 | ||
1265 | 646 | # Caller sends paths as bytes; Launchpad returns a list of (path, | 646 | # Caller sends paths as bytes; Launchpad returns a list of (path, |
1266 | @@ -648,7 +648,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1267 | 648 | # bytes.) | 648 | # bytes.) |
1268 | 649 | ref_paths = [ref_path.data for ref_path in ref_paths] | 649 | ref_paths = [ref_path.data for ref_path in ref_paths] |
1269 | 650 | return [ | 650 | return [ |
1271 | 651 | (xmlrpc_client.Binary(ref_path), | 651 | (xmlrpc.client.Binary(ref_path), |
1272 | 652 | self._renderPermissions(permissions)) | 652 | self._renderPermissions(permissions)) |
1273 | 653 | for ref_path, permissions in repository.checkRefPermissions( | 653 | for ref_path, permissions in repository.checkRefPermissions( |
1274 | 654 | requester, ref_paths).items() | 654 | requester, ref_paths).items() |
1275 | @@ -666,7 +666,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1276 | 666 | requester_id, self._checkRefPermissions, | 666 | requester_id, self._checkRefPermissions, |
1277 | 667 | translated_path, ref_paths, auth_params) | 667 | translated_path, ref_paths, auth_params) |
1278 | 668 | try: | 668 | try: |
1280 | 669 | if isinstance(result, xmlrpc_client.Fault): | 669 | if isinstance(result, xmlrpc.client.Fault): |
1281 | 670 | logger.error("checkRefPermissions failed: %r", result) | 670 | logger.error("checkRefPermissions failed: %r", result) |
1282 | 671 | else: | 671 | else: |
1283 | 672 | # The results of ref permission checks are not sensitive for | 672 | # The results of ref permission checks are not sensitive for |
1284 | @@ -736,7 +736,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1285 | 736 | except Exception as e: | 736 | except Exception as e: |
1286 | 737 | result = e | 737 | result = e |
1287 | 738 | try: | 738 | try: |
1289 | 739 | if isinstance(result, xmlrpc_client.Fault): | 739 | if isinstance(result, xmlrpc.client.Fault): |
1290 | 740 | logger.error("confirmRepoCreation failed: %r", result) | 740 | logger.error("confirmRepoCreation failed: %r", result) |
1291 | 741 | else: | 741 | else: |
1292 | 742 | logger.info("confirmRepoCreation succeeded: %s" % result) | 742 | logger.info("confirmRepoCreation succeeded: %s" % result) |
1293 | @@ -767,7 +767,7 @@ class GitAPI(LaunchpadXMLRPCView): | |||
1294 | 767 | except Exception as e: | 767 | except Exception as e: |
1295 | 768 | result = e | 768 | result = e |
1296 | 769 | try: | 769 | try: |
1298 | 770 | if isinstance(result, xmlrpc_client.Fault): | 770 | if isinstance(result, xmlrpc.client.Fault): |
1299 | 771 | logger.error("abortRepoCreation failed: %r", result) | 771 | logger.error("abortRepoCreation failed: %r", result) |
1300 | 772 | else: | 772 | else: |
1301 | 773 | logger.info("abortRepoCreation succeeded: %s" % result) | 773 | logger.info("abortRepoCreation succeeded: %s" % result) |
1302 | diff --git a/lib/lp/code/xmlrpc/tests/test_branch.py b/lib/lp/code/xmlrpc/tests/test_branch.py | |||
1303 | index 898ebd6..41d55d7 100644 | |||
1304 | --- a/lib/lp/code/xmlrpc/tests/test_branch.py | |||
1305 | +++ b/lib/lp/code/xmlrpc/tests/test_branch.py | |||
1306 | @@ -4,10 +4,10 @@ | |||
1307 | 4 | """Unit tests for the public codehosting API.""" | 4 | """Unit tests for the public codehosting API.""" |
1308 | 5 | 5 | ||
1309 | 6 | import os | 6 | import os |
1310 | 7 | import xmlrpc.client | ||
1311 | 7 | 8 | ||
1312 | 8 | from breezy import urlutils | 9 | from breezy import urlutils |
1313 | 9 | from lazr.uri import URI | 10 | from lazr.uri import URI |
1314 | 10 | from six.moves import xmlrpc_client | ||
1315 | 11 | from zope.security.proxy import removeSecurityProxy | 11 | from zope.security.proxy import removeSecurityProxy |
1316 | 12 | 12 | ||
1317 | 13 | from lp.app.enums import InformationType | 13 | from lp.app.enums import InformationType |
1318 | @@ -79,7 +79,7 @@ class TestExpandURL(TestCaseWithFactory): | |||
1319 | 79 | api = PublicCodehostingAPI(None, None) | 79 | api = PublicCodehostingAPI(None, None) |
1320 | 80 | fault = api.resolve_lp_path(lp_url_path) | 80 | fault = api.resolve_lp_path(lp_url_path) |
1321 | 81 | self.assertTrue( | 81 | self.assertTrue( |
1323 | 82 | isinstance(fault, xmlrpc_client.Fault), | 82 | isinstance(fault, xmlrpc.client.Fault), |
1324 | 83 | "resolve_lp_path(%r) returned %r, not a Fault." | 83 | "resolve_lp_path(%r) returned %r, not a Fault." |
1325 | 84 | % (lp_url_path, fault)) | 84 | % (lp_url_path, fault)) |
1326 | 85 | self.assertEqual(expected_fault.__class__, fault.__class__) | 85 | self.assertEqual(expected_fault.__class__, fault.__class__) |
1327 | diff --git a/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py b/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py | |||
1328 | index 8a77f5b..7c0ec97 100644 | |||
1329 | --- a/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py | |||
1330 | +++ b/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py | |||
1331 | @@ -3,7 +3,8 @@ | |||
1332 | 3 | 3 | ||
1333 | 4 | """Test for the methods of `ICodeImportScheduler`.""" | 4 | """Test for the methods of `ICodeImportScheduler`.""" |
1334 | 5 | 5 | ||
1336 | 6 | from six.moves import xmlrpc_client | 6 | import xmlrpc.client |
1337 | 7 | |||
1338 | 7 | import transaction | 8 | import transaction |
1339 | 8 | from zope.component import getUtility | 9 | from zope.component import getUtility |
1340 | 9 | from zope.security.proxy import removeSecurityProxy | 10 | from zope.security.proxy import removeSecurityProxy |
1341 | @@ -76,7 +77,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): | |||
1342 | 76 | # is no code import job with the given ID. | 77 | # is no code import job with the given ID. |
1343 | 77 | fault = self.api.getImportDataForJobID(-1) | 78 | fault = self.api.getImportDataForJobID(-1) |
1344 | 78 | self.assertTrue( | 79 | self.assertTrue( |
1346 | 79 | isinstance(fault, xmlrpc_client.Fault), | 80 | isinstance(fault, xmlrpc.client.Fault), |
1347 | 80 | "getImportDataForJobID(-1) returned %r, not a Fault." | 81 | "getImportDataForJobID(-1) returned %r, not a Fault." |
1348 | 81 | % (fault,)) | 82 | % (fault,)) |
1349 | 82 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) | 83 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) |
1350 | @@ -95,7 +96,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): | |||
1351 | 95 | # code import job with the given ID. | 96 | # code import job with the given ID. |
1352 | 96 | fault = self.api.updateHeartbeat(-1, '') | 97 | fault = self.api.updateHeartbeat(-1, '') |
1353 | 97 | self.assertTrue( | 98 | self.assertTrue( |
1355 | 98 | isinstance(fault, xmlrpc_client.Fault), | 99 | isinstance(fault, xmlrpc.client.Fault), |
1356 | 99 | "updateHeartbeat(-1, '') returned %r, not a Fault." | 100 | "updateHeartbeat(-1, '') returned %r, not a Fault." |
1357 | 100 | % (fault,)) | 101 | % (fault,)) |
1358 | 101 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) | 102 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) |
1359 | @@ -131,7 +132,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): | |||
1360 | 131 | code_import = code_import_job.code_import | 132 | code_import = code_import_job.code_import |
1361 | 132 | self.api.finishJobID( | 133 | self.api.finishJobID( |
1362 | 133 | code_import_job.id, CodeImportResultStatus.SUCCESS.name, | 134 | code_import_job.id, CodeImportResultStatus.SUCCESS.name, |
1364 | 134 | xmlrpc_client.Binary(b'log file data\n')) | 135 | xmlrpc.client.Binary(b'log file data\n')) |
1365 | 135 | transaction.commit() | 136 | transaction.commit() |
1366 | 136 | self.assertEqual( | 137 | self.assertEqual( |
1367 | 137 | b'log file data\n', code_import.results.last().log_file.read()) | 138 | b'log file data\n', code_import.results.last().log_file.read()) |
1368 | @@ -143,7 +144,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): | |||
1369 | 143 | code_import = code_import_job.code_import | 144 | code_import = code_import_job.code_import |
1370 | 144 | self.api.finishJobID( | 145 | self.api.finishJobID( |
1371 | 145 | code_import_job.id, CodeImportResultStatus.SUCCESS.name, | 146 | code_import_job.id, CodeImportResultStatus.SUCCESS.name, |
1373 | 146 | xmlrpc_client.Binary(b'')) | 147 | xmlrpc.client.Binary(b'')) |
1374 | 147 | self.assertIsNone(code_import.results.last().log_file) | 148 | self.assertIsNone(code_import.results.last().log_file) |
1375 | 148 | 149 | ||
1376 | 149 | def test_finishJobID_not_found(self): | 150 | def test_finishJobID_not_found(self): |
1377 | @@ -152,7 +153,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): | |||
1378 | 152 | fault = self.api.finishJobID( | 153 | fault = self.api.finishJobID( |
1379 | 153 | -1, CodeImportResultStatus.SUCCESS.name, '') | 154 | -1, CodeImportResultStatus.SUCCESS.name, '') |
1380 | 154 | self.assertTrue( | 155 | self.assertTrue( |
1382 | 155 | isinstance(fault, xmlrpc_client.Fault), | 156 | isinstance(fault, xmlrpc.client.Fault), |
1383 | 156 | "finishJobID(-1, 'SUCCESS', 0) returned %r, not a Fault." | 157 | "finishJobID(-1, 'SUCCESS', 0) returned %r, not a Fault." |
1384 | 157 | % (fault,)) | 158 | % (fault,)) |
1385 | 158 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) | 159 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) |
1386 | diff --git a/lib/lp/code/xmlrpc/tests/test_git.py b/lib/lp/code/xmlrpc/tests/test_git.py | |||
1387 | index 6726db0..27c78c4 100644 | |||
1388 | --- a/lib/lp/code/xmlrpc/tests/test_git.py | |||
1389 | +++ b/lib/lp/code/xmlrpc/tests/test_git.py | |||
1390 | @@ -6,12 +6,12 @@ | |||
1391 | 6 | from datetime import datetime | 6 | from datetime import datetime |
1392 | 7 | import hashlib | 7 | import hashlib |
1393 | 8 | import uuid | 8 | import uuid |
1394 | 9 | import xmlrpc.client | ||
1395 | 9 | 10 | ||
1396 | 10 | from fixtures import FakeLogger | 11 | from fixtures import FakeLogger |
1397 | 11 | from pymacaroons import Macaroon | 12 | from pymacaroons import Macaroon |
1398 | 12 | import pytz | 13 | import pytz |
1399 | 13 | import six | 14 | import six |
1400 | 14 | from six.moves import xmlrpc_client | ||
1401 | 15 | from six.moves.urllib.parse import quote | 15 | from six.moves.urllib.parse import quote |
1402 | 16 | from storm.store import Store | 16 | from storm.store import Store |
1403 | 17 | from testtools.matchers import ( | 17 | from testtools.matchers import ( |
1404 | @@ -157,7 +157,7 @@ class TestGitAPIMixin: | |||
1405 | 157 | 157 | ||
1406 | 158 | def setUp(self): | 158 | def setUp(self): |
1407 | 159 | super(TestGitAPIMixin, self).setUp() | 159 | super(TestGitAPIMixin, self).setUp() |
1409 | 160 | self.git_api = xmlrpc_client.ServerProxy( | 160 | self.git_api = xmlrpc.client.ServerProxy( |
1410 | 161 | "http://xmlrpc-private.launchpad.test:8087/git", | 161 | "http://xmlrpc-private.launchpad.test:8087/git", |
1411 | 162 | transport=XMLRPCTestTransport()) | 162 | transport=XMLRPCTestTransport()) |
1412 | 163 | self.hosting_fixture = self.useFixture(GitHostingFixture()) | 163 | self.hosting_fixture = self.useFixture(GitHostingFixture()) |
1413 | @@ -169,7 +169,7 @@ class TestGitAPIMixin: | |||
1414 | 169 | """Assert that a call raises the expected fault.""" | 169 | """Assert that a call raises the expected fault.""" |
1415 | 170 | with FakeLogger() as logger: | 170 | with FakeLogger() as logger: |
1416 | 171 | fault = self.assertRaises( | 171 | fault = self.assertRaises( |
1418 | 172 | xmlrpc_client.Fault, getattr(self.git_api, func_name), | 172 | xmlrpc.client.Fault, getattr(self.git_api, func_name), |
1419 | 173 | *args, **kwargs) | 173 | *args, **kwargs) |
1420 | 174 | self.assertThat(fault, MatchesFault(expected_fault)) | 174 | self.assertThat(fault, MatchesFault(expected_fault)) |
1421 | 175 | self.assertThat(logger.output, MatchesRegex( | 175 | self.assertThat(logger.output, MatchesRegex( |
1422 | @@ -468,14 +468,14 @@ class TestGitAPIMixin: | |||
1423 | 468 | request_id = auth_params["request-id"] | 468 | request_id = auth_params["request-id"] |
1424 | 469 | translated_path = removeSecurityProxy(repository).getInternalPath() | 469 | translated_path = removeSecurityProxy(repository).getInternalPath() |
1425 | 470 | ref_paths = [ | 470 | ref_paths = [ |
1427 | 471 | xmlrpc_client.Binary(ref_path) for ref_path in ref_paths] | 471 | xmlrpc.client.Binary(ref_path) for ref_path in ref_paths] |
1428 | 472 | results = self.assertDoesNotFault( | 472 | results = self.assertDoesNotFault( |
1429 | 473 | request_id, "checkRefPermissions", | 473 | request_id, "checkRefPermissions", |
1430 | 474 | translated_path, ref_paths, auth_params) | 474 | translated_path, ref_paths, auth_params) |
1431 | 475 | self.assertThat(results, MatchesSetwise(*( | 475 | self.assertThat(results, MatchesSetwise(*( |
1432 | 476 | MatchesListwise([ | 476 | MatchesListwise([ |
1433 | 477 | MatchesAll( | 477 | MatchesAll( |
1435 | 478 | IsInstance(xmlrpc_client.Binary), | 478 | IsInstance(xmlrpc.client.Binary), |
1436 | 479 | MatchesStructure.byEquality(data=ref_path)), | 479 | MatchesStructure.byEquality(data=ref_path)), |
1437 | 480 | Equals(ref_permissions), | 480 | Equals(ref_permissions), |
1438 | 481 | ]) | 481 | ]) |
1439 | diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py | |||
1440 | index f23c4e5..d68cc22 100644 | |||
1441 | --- a/lib/lp/codehosting/inmemory.py | |||
1442 | +++ b/lib/lp/codehosting/inmemory.py | |||
1443 | @@ -9,13 +9,13 @@ __all__ = [ | |||
1444 | 9 | ] | 9 | ] |
1445 | 10 | 10 | ||
1446 | 11 | import operator | 11 | import operator |
1447 | 12 | from xmlrpc.client import Fault | ||
1448 | 12 | 13 | ||
1449 | 13 | from breezy.urlutils import ( | 14 | from breezy.urlutils import ( |
1450 | 14 | escape, | 15 | escape, |
1451 | 15 | unescape, | 16 | unescape, |
1452 | 16 | ) | 17 | ) |
1453 | 17 | import six | 18 | import six |
1454 | 18 | from six.moves.xmlrpc_client import Fault | ||
1455 | 19 | from twisted.internet import defer | 19 | from twisted.internet import defer |
1456 | 20 | from zope.component import ( | 20 | from zope.component import ( |
1457 | 21 | adapter, | 21 | adapter, |
1458 | diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py | |||
1459 | index 1bf9d70..7189670 100644 | |||
1460 | --- a/lib/lp/codehosting/tests/test_acceptance.py | |||
1461 | +++ b/lib/lp/codehosting/tests/test_acceptance.py | |||
1462 | @@ -5,6 +5,7 @@ | |||
1463 | 5 | 5 | ||
1464 | 6 | import os | 6 | import os |
1465 | 7 | import re | 7 | import re |
1466 | 8 | import xmlrpc.client | ||
1467 | 8 | 9 | ||
1468 | 9 | import breezy.branch | 10 | import breezy.branch |
1469 | 10 | from breezy.tests import TestCaseWithTransport | 11 | from breezy.tests import TestCaseWithTransport |
1470 | @@ -12,7 +13,6 @@ from breezy.tests.per_repository import all_repository_format_scenarios | |||
1471 | 12 | from breezy.urlutils import local_path_from_url | 13 | from breezy.urlutils import local_path_from_url |
1472 | 13 | from breezy.workingtree import WorkingTree | 14 | from breezy.workingtree import WorkingTree |
1473 | 14 | import six | 15 | import six |
1474 | 15 | from six.moves import xmlrpc_client | ||
1475 | 16 | from six.moves.urllib.request import urlopen | 16 | from six.moves.urllib.request import urlopen |
1476 | 17 | from testscenarios import ( | 17 | from testscenarios import ( |
1477 | 18 | load_tests_apply_scenarios, | 18 | load_tests_apply_scenarios, |
1478 | @@ -229,9 +229,9 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory): | |||
1479 | 229 | Used to create branches that the test user is not able to create, and | 229 | Used to create branches that the test user is not able to create, and |
1480 | 230 | might not even be able to view. | 230 | might not even be able to view. |
1481 | 231 | """ | 231 | """ |
1483 | 232 | authserver = xmlrpc_client.ServerProxy( | 232 | authserver = xmlrpc.client.ServerProxy( |
1484 | 233 | config.codehosting.authentication_endpoint) | 233 | config.codehosting.authentication_endpoint) |
1486 | 234 | codehosting_api = xmlrpc_client.ServerProxy( | 234 | codehosting_api = xmlrpc.client.ServerProxy( |
1487 | 235 | config.codehosting.codehosting_endpoint) | 235 | config.codehosting.codehosting_endpoint) |
1488 | 236 | if creator is None: | 236 | if creator is None: |
1489 | 237 | creator_id = authserver.getUserAndSSHKeys(user)['id'] | 237 | creator_id = authserver.getUserAndSSHKeys(user)['id'] |
1490 | diff --git a/lib/lp/codehosting/vfs/branchfs.py b/lib/lp/codehosting/vfs/branchfs.py | |||
1491 | index 02cf0e0..240892b 100644 | |||
1492 | --- a/lib/lp/codehosting/vfs/branchfs.py | |||
1493 | +++ b/lib/lp/codehosting/vfs/branchfs.py | |||
1494 | @@ -54,6 +54,7 @@ __all__ = [ | |||
1495 | 54 | 54 | ||
1496 | 55 | import os.path | 55 | import os.path |
1497 | 56 | import sys | 56 | import sys |
1498 | 57 | import xmlrpc.client | ||
1499 | 57 | 58 | ||
1500 | 58 | from breezy import urlutils | 59 | from breezy import urlutils |
1501 | 59 | from breezy.bzr.bzrdir import BzrDir | 60 | from breezy.bzr.bzrdir import BzrDir |
1502 | @@ -69,7 +70,6 @@ from breezy.transport import get_transport | |||
1503 | 69 | from breezy.transport.memory import MemoryServer | 70 | from breezy.transport.memory import MemoryServer |
1504 | 70 | from lazr.uri import URI | 71 | from lazr.uri import URI |
1505 | 71 | import six | 72 | import six |
1506 | 72 | from six.moves import xmlrpc_client | ||
1507 | 73 | from twisted.internet import ( | 73 | from twisted.internet import ( |
1508 | 74 | defer, | 74 | defer, |
1509 | 75 | error, | 75 | error, |
1510 | @@ -170,7 +170,7 @@ def is_lock_directory(absolute_path): | |||
1511 | 170 | 170 | ||
1512 | 171 | def get_ro_server(): | 171 | def get_ro_server(): |
1513 | 172 | """Get a Launchpad internal server for scanning branches.""" | 172 | """Get a Launchpad internal server for scanning branches.""" |
1515 | 173 | proxy = xmlrpc_client.ServerProxy(config.codehosting.codehosting_endpoint) | 173 | proxy = xmlrpc.client.ServerProxy(config.codehosting.codehosting_endpoint) |
1516 | 174 | codehosting_endpoint = DeferredBlockingProxy(proxy) | 174 | codehosting_endpoint = DeferredBlockingProxy(proxy) |
1517 | 175 | branch_transport = get_readonly_transport( | 175 | branch_transport = get_readonly_transport( |
1518 | 176 | get_transport(config.codehosting.internal_branch_by_id_root)) | 176 | get_transport(config.codehosting.internal_branch_by_id_root)) |
1519 | @@ -193,7 +193,7 @@ def get_rw_server(direct_database=False): | |||
1520 | 193 | if direct_database: | 193 | if direct_database: |
1521 | 194 | return DirectDatabaseLaunchpadServer('lp-internal:///', transport) | 194 | return DirectDatabaseLaunchpadServer('lp-internal:///', transport) |
1522 | 195 | else: | 195 | else: |
1524 | 196 | proxy = xmlrpc_client.ServerProxy( | 196 | proxy = xmlrpc.client.ServerProxy( |
1525 | 197 | config.codehosting.codehosting_endpoint) | 197 | config.codehosting.codehosting_endpoint) |
1526 | 198 | codehosting_endpoint = DeferredBlockingProxy(proxy) | 198 | codehosting_endpoint = DeferredBlockingProxy(proxy) |
1527 | 199 | return LaunchpadInternalServer( | 199 | return LaunchpadInternalServer( |
1528 | @@ -749,7 +749,7 @@ def get_lp_server(user_id, codehosting_endpoint_url=None, branch_url=None, | |||
1529 | 749 | raise AssertionError( | 749 | raise AssertionError( |
1530 | 750 | "can't supply both branch_url and branch_transport!") | 750 | "can't supply both branch_url and branch_transport!") |
1531 | 751 | 751 | ||
1533 | 752 | codehosting_client = xmlrpc_client.ServerProxy(codehosting_endpoint_url) | 752 | codehosting_client = xmlrpc.client.ServerProxy(codehosting_endpoint_url) |
1534 | 753 | lp_server = LaunchpadServer( | 753 | lp_server = LaunchpadServer( |
1535 | 754 | DeferredBlockingProxy(codehosting_client), user_id, branch_transport, | 754 | DeferredBlockingProxy(codehosting_client), user_id, branch_transport, |
1536 | 755 | seen_new_branch_hook) | 755 | seen_new_branch_hook) |
1537 | diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py | |||
1538 | index 057c231..d2b96a3 100644 | |||
1539 | --- a/lib/lp/codehosting/vfs/tests/test_branchfs.py | |||
1540 | +++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py | |||
1541 | @@ -6,6 +6,7 @@ | |||
1542 | 6 | import os | 6 | import os |
1543 | 7 | import re | 7 | import re |
1544 | 8 | import sys | 8 | import sys |
1545 | 9 | import xmlrpc.client | ||
1546 | 9 | 10 | ||
1547 | 10 | from breezy import errors | 11 | from breezy import errors |
1548 | 11 | from breezy.bzr.bzrdir import BzrDir | 12 | from breezy.bzr.bzrdir import BzrDir |
1549 | @@ -33,7 +34,6 @@ from breezy.urlutils import ( | |||
1550 | 33 | ) | 34 | ) |
1551 | 34 | from fixtures import MonkeyPatch | 35 | from fixtures import MonkeyPatch |
1552 | 35 | import six | 36 | import six |
1553 | 36 | from six.moves import xmlrpc_client | ||
1554 | 37 | from testtools.twistedsupport import ( | 37 | from testtools.twistedsupport import ( |
1555 | 38 | assert_fails_with, | 38 | assert_fails_with, |
1556 | 39 | AsynchronousDeferredRunTest, | 39 | AsynchronousDeferredRunTest, |
1557 | @@ -1035,7 +1035,7 @@ class TestBranchChangedErrorHandling(TestCaseWithTransport, TestCase): | |||
1558 | 1035 | report = errorlog.globalErrorUtility.raising(f, request) | 1035 | report = errorlog.globalErrorUtility.raising(f, request) |
1559 | 1036 | # Record the id for checking later. | 1036 | # Record the id for checking later. |
1560 | 1037 | self.generated_oopsids.append(report['id']) | 1037 | self.generated_oopsids.append(report['id']) |
1562 | 1038 | raise xmlrpc_client.Fault(-1, report) | 1038 | raise xmlrpc.client.Fault(-1, report) |
1563 | 1039 | 1039 | ||
1564 | 1040 | def get_server(self): | 1040 | def get_server(self): |
1565 | 1041 | if self._server is None: | 1041 | if self._server is None: |
1566 | diff --git a/lib/lp/registry/tests/mailinglists_helper.py b/lib/lp/registry/tests/mailinglists_helper.py | |||
1567 | index 2f926d9..20ace5c 100644 | |||
1568 | --- a/lib/lp/registry/tests/mailinglists_helper.py | |||
1569 | +++ b/lib/lp/registry/tests/mailinglists_helper.py | |||
1570 | @@ -10,7 +10,8 @@ __all__ = [ | |||
1571 | 10 | 'new_team', | 10 | 'new_team', |
1572 | 11 | ] | 11 | ] |
1573 | 12 | 12 | ||
1575 | 13 | from six.moves import xmlrpc_client | 13 | import xmlrpc.client |
1576 | 14 | |||
1577 | 14 | from zope.component import getUtility | 15 | from zope.component import getUtility |
1578 | 15 | 16 | ||
1579 | 16 | from lp.registry.enums import TeamMembershipPolicy | 17 | from lp.registry.enums import TeamMembershipPolicy |
1580 | @@ -36,7 +37,7 @@ def fault_catcher(func): | |||
1581 | 36 | 37 | ||
1582 | 37 | def caller(self, *args, **kws): | 38 | def caller(self, *args, **kws): |
1583 | 38 | result = func(self, *args, **kws) | 39 | result = func(self, *args, **kws) |
1585 | 39 | if isinstance(result, xmlrpc_client.Fault): | 40 | if isinstance(result, xmlrpc.client.Fault): |
1586 | 40 | raise result | 41 | raise result |
1587 | 41 | else: | 42 | else: |
1588 | 42 | return result | 43 | return result |
1589 | diff --git a/lib/lp/registry/tests/test_mailinglistapi.py b/lib/lp/registry/tests/test_mailinglistapi.py | |||
1590 | index 08f7f9c..be9f182 100644 | |||
1591 | --- a/lib/lp/registry/tests/test_mailinglistapi.py | |||
1592 | +++ b/lib/lp/registry/tests/test_mailinglistapi.py | |||
1593 | @@ -7,8 +7,8 @@ __all__ = [] | |||
1594 | 7 | 7 | ||
1595 | 8 | import email | 8 | import email |
1596 | 9 | from textwrap import dedent | 9 | from textwrap import dedent |
1597 | 10 | import xmlrpc.client | ||
1598 | 10 | 11 | ||
1599 | 11 | from six.moves import xmlrpc_client | ||
1600 | 12 | from testtools.matchers import ( | 12 | from testtools.matchers import ( |
1601 | 13 | Equals, | 13 | Equals, |
1602 | 14 | MatchesDict, | 14 | MatchesDict, |
1603 | @@ -498,7 +498,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory): | |||
1604 | 498 | I put \xa9 in the body. | 498 | I put \xa9 in the body. |
1605 | 499 | """).encode('ISO-8859-1')) | 499 | """).encode('ISO-8859-1')) |
1606 | 500 | info = self.mailinglist_api.holdMessage( | 500 | info = self.mailinglist_api.holdMessage( |
1608 | 501 | 'team', xmlrpc_client.Binary(message_as_bytes(message))) | 501 | 'team', xmlrpc.client.Binary(message_as_bytes(message))) |
1609 | 502 | transaction.commit() | 502 | transaction.commit() |
1610 | 503 | found = self.message_approval_set.getMessageByMessageID('<\\xa9-me>') | 503 | found = self.message_approval_set.getMessageByMessageID('<\\xa9-me>') |
1611 | 504 | self.assertIs(True, info) | 504 | self.assertIs(True, info) |
1612 | diff --git a/lib/lp/registry/tests/test_xmlrpc.py b/lib/lp/registry/tests/test_xmlrpc.py | |||
1613 | index dc9507b..fccd0bf 100644 | |||
1614 | --- a/lib/lp/registry/tests/test_xmlrpc.py | |||
1615 | +++ b/lib/lp/registry/tests/test_xmlrpc.py | |||
1616 | @@ -5,8 +5,8 @@ | |||
1617 | 5 | 5 | ||
1618 | 6 | from email import message_from_string | 6 | from email import message_from_string |
1619 | 7 | from textwrap import dedent | 7 | from textwrap import dedent |
1620 | 8 | import xmlrpc.client | ||
1621 | 8 | 9 | ||
1622 | 9 | from six.moves import xmlrpc_client | ||
1623 | 10 | from zope.component import getUtility | 10 | from zope.component import getUtility |
1624 | 11 | from zope.security.proxy import removeSecurityProxy | 11 | from zope.security.proxy import removeSecurityProxy |
1625 | 12 | 12 | ||
1626 | @@ -42,7 +42,7 @@ class TestCanonicalSSOApplication(TestCaseWithFactory): | |||
1627 | 42 | 42 | ||
1628 | 43 | def setUp(self): | 43 | def setUp(self): |
1629 | 44 | super(TestCanonicalSSOApplication, self).setUp() | 44 | super(TestCanonicalSSOApplication, self).setUp() |
1631 | 45 | self.rpc_proxy = xmlrpc_client.ServerProxy( | 45 | self.rpc_proxy = xmlrpc.client.ServerProxy( |
1632 | 46 | 'http://xmlrpc-private.launchpad.test:8087/canonicalsso', | 46 | 'http://xmlrpc-private.launchpad.test:8087/canonicalsso', |
1633 | 47 | transport=XMLRPCTestTransport()) | 47 | transport=XMLRPCTestTransport()) |
1634 | 48 | 48 | ||
1635 | @@ -71,12 +71,12 @@ class TestCanonicalSSOApplication(TestCaseWithFactory): | |||
1636 | 71 | person = self.factory.makePerson() | 71 | person = self.factory.makePerson() |
1637 | 72 | openid_identifier = removeSecurityProxy( | 72 | openid_identifier = removeSecurityProxy( |
1638 | 73 | person.account).openid_identifiers.any().identifier | 73 | person.account).openid_identifiers.any().identifier |
1640 | 74 | public_rpc_proxy = xmlrpc_client.ServerProxy( | 74 | public_rpc_proxy = xmlrpc.client.ServerProxy( |
1641 | 75 | 'http://test@canonical.com:test@' | 75 | 'http://test@canonical.com:test@' |
1642 | 76 | 'xmlrpc.launchpad.test/canonicalsso', | 76 | 'xmlrpc.launchpad.test/canonicalsso', |
1643 | 77 | transport=XMLRPCTestTransport()) | 77 | transport=XMLRPCTestTransport()) |
1644 | 78 | e = self.assertRaises( | 78 | e = self.assertRaises( |
1646 | 79 | xmlrpc_client.ProtocolError, | 79 | xmlrpc.client.ProtocolError, |
1647 | 80 | public_rpc_proxy.getPersonDetailsByOpenIDIdentifier, | 80 | public_rpc_proxy.getPersonDetailsByOpenIDIdentifier, |
1648 | 81 | openid_identifier) | 81 | openid_identifier) |
1649 | 82 | self.assertEqual(404, e.errcode) | 82 | self.assertEqual(404, e.errcode) |
1650 | @@ -88,7 +88,7 @@ class TestMailingListXMLRPC(TestCaseWithFactory): | |||
1651 | 88 | 88 | ||
1652 | 89 | def setUp(self): | 89 | def setUp(self): |
1653 | 90 | super(TestMailingListXMLRPC, self).setUp() | 90 | super(TestMailingListXMLRPC, self).setUp() |
1655 | 91 | self.rpc_proxy = xmlrpc_client.ServerProxy( | 91 | self.rpc_proxy = xmlrpc.client.ServerProxy( |
1656 | 92 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', | 92 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', |
1657 | 93 | transport=XMLRPCTestTransport()) | 93 | transport=XMLRPCTestTransport()) |
1658 | 94 | 94 | ||
1659 | @@ -147,7 +147,7 @@ class TestMailingListXMLRPCMessage(TestCaseWithFactory): | |||
1660 | 147 | 147 | ||
1661 | 148 | def setUp(self): | 148 | def setUp(self): |
1662 | 149 | super(TestMailingListXMLRPCMessage, self).setUp() | 149 | super(TestMailingListXMLRPCMessage, self).setUp() |
1664 | 150 | self.rpc_proxy = xmlrpc_client.ServerProxy( | 150 | self.rpc_proxy = xmlrpc.client.ServerProxy( |
1665 | 151 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', | 151 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', |
1666 | 152 | transport=XMLRPCTestTransport()) | 152 | transport=XMLRPCTestTransport()) |
1667 | 153 | 153 | ||
1668 | diff --git a/lib/lp/registry/xmlrpc/mailinglist.py b/lib/lp/registry/xmlrpc/mailinglist.py | |||
1669 | index 829c740..4dd50eb 100644 | |||
1670 | --- a/lib/lp/registry/xmlrpc/mailinglist.py | |||
1671 | +++ b/lib/lp/registry/xmlrpc/mailinglist.py | |||
1672 | @@ -8,9 +8,9 @@ __all__ = [ | |||
1673 | 8 | ] | 8 | ] |
1674 | 9 | 9 | ||
1675 | 10 | import re | 10 | import re |
1676 | 11 | import xmlrpc.client | ||
1677 | 11 | 12 | ||
1678 | 12 | from six import ensure_text | 13 | from six import ensure_text |
1679 | 13 | from six.moves import xmlrpc_client | ||
1680 | 14 | from zope.component import getUtility | 14 | from zope.component import getUtility |
1681 | 15 | from zope.interface import implementer | 15 | from zope.interface import implementer |
1682 | 16 | from zope.security.proxy import removeSecurityProxy | 16 | from zope.security.proxy import removeSecurityProxy |
1683 | @@ -244,7 +244,7 @@ class MailingListAPIView(LaunchpadXMLRPCView): | |||
1684 | 244 | # non-ascii characters in the message can be safely passed across | 244 | # non-ascii characters in the message can be safely passed across |
1685 | 245 | # XMLRPC. For most tests though it's much more convenient to just | 245 | # XMLRPC. For most tests though it's much more convenient to just |
1686 | 246 | # pass 8-bit strings. | 246 | # pass 8-bit strings. |
1688 | 247 | if isinstance(bytes, xmlrpc_client.Binary): | 247 | if isinstance(bytes, xmlrpc.client.Binary): |
1689 | 248 | bytes = bytes.data | 248 | bytes = bytes.data |
1690 | 249 | team_name = ensure_text(team_name) | 249 | team_name = ensure_text(team_name) |
1691 | 250 | # Although it is illegal for an email header to have unencoded | 250 | # Although it is illegal for an email header to have unencoded |
1692 | diff --git a/lib/lp/services/authserver/tests/test_authserver.py b/lib/lp/services/authserver/tests/test_authserver.py | |||
1693 | index a2319a3..98bdabc 100644 | |||
1694 | --- a/lib/lp/services/authserver/tests/test_authserver.py | |||
1695 | +++ b/lib/lp/services/authserver/tests/test_authserver.py | |||
1696 | @@ -3,8 +3,9 @@ | |||
1697 | 3 | 3 | ||
1698 | 4 | """Tests for the internal codehosting API.""" | 4 | """Tests for the internal codehosting API.""" |
1699 | 5 | 5 | ||
1700 | 6 | import xmlrpc.client | ||
1701 | 7 | |||
1702 | 6 | from pymacaroons import Macaroon | 8 | from pymacaroons import Macaroon |
1703 | 7 | from six.moves import xmlrpc_client | ||
1704 | 8 | from storm.sqlobject import SQLObjectNotFound | 9 | from storm.sqlobject import SQLObjectNotFound |
1705 | 9 | from testtools.matchers import ( | 10 | from testtools.matchers import ( |
1706 | 10 | Equals, | 11 | Equals, |
1707 | @@ -122,7 +123,7 @@ class GetUserAndSSHKeysTests(TestCaseWithFactory): | |||
1708 | 122 | new_person = self.factory.makePerson() | 123 | new_person = self.factory.makePerson() |
1709 | 123 | with person_logged_in(new_person): | 124 | with person_logged_in(new_person): |
1710 | 124 | key = self.factory.makeSSHKey(person=new_person) | 125 | key = self.factory.makeSSHKey(person=new_person) |
1712 | 125 | authserver = xmlrpc_client.ServerProxy( | 126 | authserver = xmlrpc.client.ServerProxy( |
1713 | 126 | 'http://xmlrpc-private.launchpad.test:8087/authserver', | 127 | 'http://xmlrpc-private.launchpad.test:8087/authserver', |
1714 | 127 | transport=XMLRPCTestTransport()) | 128 | transport=XMLRPCTestTransport()) |
1715 | 128 | self.assertEqual( | 129 | self.assertEqual( |
1716 | diff --git a/lib/lp/services/features/__init__.py b/lib/lp/services/features/__init__.py | |||
1717 | index 7ee4895..e58a026 100644 | |||
1718 | --- a/lib/lp/services/features/__init__.py | |||
1719 | +++ b/lib/lp/services/features/__init__.py | |||
1720 | @@ -131,7 +131,7 @@ Checking flags without access to the database | |||
1721 | 131 | Feature flags can also be checked without access to the database by making use | 131 | Feature flags can also be checked without access to the database by making use |
1722 | 132 | of the 'getFeatureFlag' XML-RPC method. | 132 | of the 'getFeatureFlag' XML-RPC method. |
1723 | 133 | 133 | ||
1725 | 134 | server_proxy = xmlrpc_client.ServerProxy( | 134 | server_proxy = xmlrpc.client.ServerProxy( |
1726 | 135 | config.launchpad.feature_flags_endpoint, allow_none=True) | 135 | config.launchpad.feature_flags_endpoint, allow_none=True) |
1727 | 136 | if server_proxy.getFeatureFlag( | 136 | if server_proxy.getFeatureFlag( |
1728 | 137 | 'example_flag.enabled', ['user:' + user_name]): | 137 | 'example_flag.enabled', ['user:' + user_name]): |
1729 | diff --git a/lib/lp/services/features/tests/test_xmlrpc.py b/lib/lp/services/features/tests/test_xmlrpc.py | |||
1730 | index a2523d4..10cf61c 100644 | |||
1731 | --- a/lib/lp/services/features/tests/test_xmlrpc.py | |||
1732 | +++ b/lib/lp/services/features/tests/test_xmlrpc.py | |||
1733 | @@ -3,7 +3,7 @@ | |||
1734 | 3 | 3 | ||
1735 | 4 | """Tests for FeatureFlagApplication.""" | 4 | """Tests for FeatureFlagApplication.""" |
1736 | 5 | 5 | ||
1738 | 6 | from six.moves import xmlrpc_client | 6 | import xmlrpc.client |
1739 | 7 | 7 | ||
1740 | 8 | from lp.services import features | 8 | from lp.services import features |
1741 | 9 | from lp.services.config import config | 9 | from lp.services.config import config |
1742 | @@ -82,13 +82,13 @@ class TestGetFeatureFlag(TestCaseWithFactory): | |||
1743 | 82 | flag_name, ['user:' + person.name])) | 82 | flag_name, ['user:' + person.name])) |
1744 | 83 | 83 | ||
1745 | 84 | def test_xmlrpc_interface_unset(self): | 84 | def test_xmlrpc_interface_unset(self): |
1747 | 85 | sp = xmlrpc_client.ServerProxy( | 85 | sp = xmlrpc.client.ServerProxy( |
1748 | 86 | config.launchpad.feature_flags_endpoint, | 86 | config.launchpad.feature_flags_endpoint, |
1749 | 87 | transport=XMLRPCTestTransport(), allow_none=True) | 87 | transport=XMLRPCTestTransport(), allow_none=True) |
1750 | 88 | self.assertEqual(None, sp.getFeatureFlag(u'flag')) | 88 | self.assertEqual(None, sp.getFeatureFlag(u'flag')) |
1751 | 89 | 89 | ||
1752 | 90 | def test_xmlrpc_interface_set(self): | 90 | def test_xmlrpc_interface_set(self): |
1754 | 91 | sp = xmlrpc_client.ServerProxy( | 91 | sp = xmlrpc.client.ServerProxy( |
1755 | 92 | config.launchpad.feature_flags_endpoint, | 92 | config.launchpad.feature_flags_endpoint, |
1756 | 93 | transport=XMLRPCTestTransport(), allow_none=True) | 93 | transport=XMLRPCTestTransport(), allow_none=True) |
1757 | 94 | flag_name = u'flag' | 94 | flag_name = u'flag' |
1758 | diff --git a/lib/lp/services/librarianserver/db.py b/lib/lp/services/librarianserver/db.py | |||
1759 | index 972ca8f..4ed2901 100644 | |||
1760 | --- a/lib/lp/services/librarianserver/db.py | |||
1761 | +++ b/lib/lp/services/librarianserver/db.py | |||
1762 | @@ -8,13 +8,13 @@ __all__ = [ | |||
1763 | 8 | ] | 8 | ] |
1764 | 9 | 9 | ||
1765 | 10 | import hashlib | 10 | import hashlib |
1766 | 11 | from xmlrpc.client import Fault | ||
1767 | 11 | 12 | ||
1768 | 12 | from pymacaroons import Macaroon | 13 | from pymacaroons import Macaroon |
1769 | 13 | from six.moves.urllib.parse import ( | 14 | from six.moves.urllib.parse import ( |
1770 | 14 | quote, | 15 | quote, |
1771 | 15 | unquote, | 16 | unquote, |
1772 | 16 | ) | 17 | ) |
1773 | 17 | from six.moves.xmlrpc_client import Fault | ||
1774 | 18 | from storm.expr import ( | 18 | from storm.expr import ( |
1775 | 19 | And, | 19 | And, |
1776 | 20 | SQL, | 20 | SQL, |
1777 | diff --git a/lib/lp/services/tests/test_timeout.py b/lib/lp/services/tests/test_timeout.py | |||
1778 | index 6aa31d5..b337a5d 100644 | |||
1779 | --- a/lib/lp/services/tests/test_timeout.py | |||
1780 | +++ b/lib/lp/services/tests/test_timeout.py | |||
1781 | @@ -7,6 +7,7 @@ | |||
1782 | 7 | import socket | 7 | import socket |
1783 | 8 | from textwrap import dedent | 8 | from textwrap import dedent |
1784 | 9 | import threading | 9 | import threading |
1785 | 10 | import xmlrpc.client | ||
1786 | 10 | 11 | ||
1787 | 11 | from fixtures import ( | 12 | from fixtures import ( |
1788 | 12 | MonkeyPatch, | 13 | MonkeyPatch, |
1789 | @@ -17,10 +18,7 @@ from requests.exceptions import ( | |||
1790 | 17 | ConnectionError, | 18 | ConnectionError, |
1791 | 18 | InvalidSchema, | 19 | InvalidSchema, |
1792 | 19 | ) | 20 | ) |
1797 | 20 | from six.moves import ( | 21 | from six.moves import xmlrpc_server |
1794 | 21 | xmlrpc_client, | ||
1795 | 22 | xmlrpc_server, | ||
1796 | 23 | ) | ||
1798 | 24 | from testtools.matchers import ( | 22 | from testtools.matchers import ( |
1799 | 25 | ContainsDict, | 23 | ContainsDict, |
1800 | 26 | Equals, | 24 | Equals, |
1801 | @@ -505,7 +503,7 @@ class TestTimeout(TestCase): | |||
1802 | 505 | logRequests=False) | 503 | logRequests=False) |
1803 | 506 | server_thread = threading.Thread(target=server.serve_2_requests) | 504 | server_thread = threading.Thread(target=server.serve_2_requests) |
1804 | 507 | server_thread.start() | 505 | server_thread.start() |
1806 | 508 | proxy = xmlrpc_client.ServerProxy( | 506 | proxy = xmlrpc.client.ServerProxy( |
1807 | 509 | http_server_url, transport=TransportWithTimeout()) | 507 | http_server_url, transport=TransportWithTimeout()) |
1808 | 510 | self.assertEqual('Successful test message.', | 508 | self.assertEqual('Successful test message.', |
1809 | 511 | proxy.echo('Successful test message.')) | 509 | proxy.echo('Successful test message.')) |
1810 | diff --git a/lib/lp/services/timeout.py b/lib/lp/services/timeout.py | |||
1811 | index 815e08b..ff88dbe 100644 | |||
1812 | --- a/lib/lp/services/timeout.py | |||
1813 | +++ b/lib/lp/services/timeout.py | |||
1814 | @@ -24,6 +24,7 @@ from threading import ( | |||
1815 | 24 | Lock, | 24 | Lock, |
1816 | 25 | Thread, | 25 | Thread, |
1817 | 26 | ) | 26 | ) |
1818 | 27 | from xmlrpc.client import Transport | ||
1819 | 27 | 28 | ||
1820 | 28 | from requests import ( | 29 | from requests import ( |
1821 | 29 | HTTPError, | 30 | HTTPError, |
1822 | @@ -37,7 +38,6 @@ from requests_file import FileAdapter | |||
1823 | 37 | from requests_toolbelt.downloadutils import stream | 38 | from requests_toolbelt.downloadutils import stream |
1824 | 38 | import six | 39 | import six |
1825 | 39 | from six import reraise | 40 | from six import reraise |
1826 | 40 | from six.moves.xmlrpc_client import Transport | ||
1827 | 41 | from urllib3.connectionpool import ( | 41 | from urllib3.connectionpool import ( |
1828 | 42 | HTTPConnectionPool, | 42 | HTTPConnectionPool, |
1829 | 43 | HTTPSConnectionPool, | 43 | HTTPSConnectionPool, |
1830 | diff --git a/lib/lp/services/twistedsupport/xmlrpc.py b/lib/lp/services/twistedsupport/xmlrpc.py | |||
1831 | index 4c93d77..209f360 100644 | |||
1832 | --- a/lib/lp/services/twistedsupport/xmlrpc.py | |||
1833 | +++ b/lib/lp/services/twistedsupport/xmlrpc.py | |||
1834 | @@ -26,7 +26,7 @@ class BlockingProxy: | |||
1835 | 26 | def __init__(self, proxy): | 26 | def __init__(self, proxy): |
1836 | 27 | """Construct a `BlockingProxy`. | 27 | """Construct a `BlockingProxy`. |
1837 | 28 | 28 | ||
1839 | 29 | :param proxy: An xmlrpc_client.ServerProxy. | 29 | :param proxy: An xmlrpc.client.ServerProxy. |
1840 | 30 | """ | 30 | """ |
1841 | 31 | self._proxy = proxy | 31 | self._proxy = proxy |
1842 | 32 | 32 | ||
1843 | @@ -39,7 +39,7 @@ class DeferredBlockingProxy(BlockingProxy): | |||
1844 | 39 | 39 | ||
1845 | 40 | This is almost exactly like 'BlockingProxy', except that this returns | 40 | This is almost exactly like 'BlockingProxy', except that this returns |
1846 | 41 | Deferreds. It is guaranteed to be exactly as synchronous as the passed-in | 41 | Deferreds. It is guaranteed to be exactly as synchronous as the passed-in |
1848 | 42 | proxy. That means if you pass in a normal xmlrpc_client proxy you ought to | 42 | proxy. That means if you pass in a normal xmlrpc.client proxy you ought to |
1849 | 43 | be able to use `lp.services.twistedsupport.extract_result` to get the | 43 | be able to use `lp.services.twistedsupport.extract_result` to get the |
1850 | 44 | result. | 44 | result. |
1851 | 45 | """ | 45 | """ |
1852 | diff --git a/lib/lp/services/webapp/servers.py b/lib/lp/services/webapp/servers.py | |||
1853 | index 31afcbf..eef5ede 100644 | |||
1854 | --- a/lib/lp/services/webapp/servers.py | |||
1855 | +++ b/lib/lp/services/webapp/servers.py | |||
1856 | @@ -4,6 +4,7 @@ | |||
1857 | 4 | """Definition of the internet servers that Launchpad uses.""" | 4 | """Definition of the internet servers that Launchpad uses.""" |
1858 | 5 | 5 | ||
1859 | 6 | import threading | 6 | import threading |
1860 | 7 | import xmlrpc.client | ||
1861 | 7 | 8 | ||
1862 | 8 | from lazr.restful.interfaces import ( | 9 | from lazr.restful.interfaces import ( |
1863 | 9 | ICollectionResource, | 10 | ICollectionResource, |
1864 | @@ -17,7 +18,6 @@ from lazr.restful.publisher import ( | |||
1865 | 17 | from lazr.restful.utils import get_current_browser_request | 18 | from lazr.restful.utils import get_current_browser_request |
1866 | 18 | from lazr.uri import URI | 19 | from lazr.uri import URI |
1867 | 19 | import six | 20 | import six |
1868 | 20 | from six.moves import xmlrpc_client | ||
1869 | 21 | from six.moves.urllib.parse import parse_qs | 21 | from six.moves.urllib.parse import parse_qs |
1870 | 22 | from talisker.logs import logging_context | 22 | from talisker.logs import logging_context |
1871 | 23 | import transaction | 23 | import transaction |
1872 | @@ -1403,15 +1403,15 @@ class PublicXMLRPCResponse(XMLRPCResponse): | |||
1873 | 1403 | """Response type for doing public XML-RPC in Launchpad.""" | 1403 | """Response type for doing public XML-RPC in Launchpad.""" |
1874 | 1404 | 1404 | ||
1875 | 1405 | def handleException(self, exc_info): | 1405 | def handleException(self, exc_info): |
1877 | 1406 | # If we don't have a proper xmlrpc_client.Fault, and we have | 1406 | # If we don't have a proper xmlrpc.client.Fault, and we have |
1878 | 1407 | # logged an OOPS, create a Fault that reports the OOPS ID to | 1407 | # logged an OOPS, create a Fault that reports the OOPS ID to |
1879 | 1408 | # the user. | 1408 | # the user. |
1880 | 1409 | exc_value = exc_info[1] | 1409 | exc_value = exc_info[1] |
1882 | 1410 | if not isinstance(exc_value, xmlrpc_client.Fault): | 1410 | if not isinstance(exc_value, xmlrpc.client.Fault): |
1883 | 1411 | request = get_current_browser_request() | 1411 | request = get_current_browser_request() |
1884 | 1412 | if request is not None and request.oopsid is not None: | 1412 | if request is not None and request.oopsid is not None: |
1887 | 1413 | exc_info = (xmlrpc_client.Fault, | 1413 | exc_info = (xmlrpc.client.Fault, |
1888 | 1414 | xmlrpc_client.Fault(-1, request.oopsid), | 1414 | xmlrpc.client.Fault(-1, request.oopsid), |
1889 | 1415 | None) | 1415 | None) |
1890 | 1416 | XMLRPCResponse.handleException(self, exc_info) | 1416 | XMLRPCResponse.handleException(self, exc_info) |
1891 | 1417 | 1417 | ||
1892 | diff --git a/lib/lp/services/xmlrpc.py b/lib/lp/services/xmlrpc.py | |||
1893 | index 944dec1..f34154c 100644 | |||
1894 | --- a/lib/lp/services/xmlrpc.py | |||
1895 | +++ b/lib/lp/services/xmlrpc.py | |||
1896 | @@ -9,16 +9,16 @@ __all__ = [ | |||
1897 | 9 | ] | 9 | ] |
1898 | 10 | 10 | ||
1899 | 11 | import socket | 11 | import socket |
1900 | 12 | import xmlrpc.client | ||
1901 | 12 | 13 | ||
1902 | 13 | from defusedxml.xmlrpc import monkey_patch | 14 | from defusedxml.xmlrpc import monkey_patch |
1903 | 14 | from six.moves import xmlrpc_client | ||
1904 | 15 | 15 | ||
1905 | 16 | 16 | ||
1906 | 17 | # Protect against various XML parsing vulnerabilities. | 17 | # Protect against various XML parsing vulnerabilities. |
1907 | 18 | monkey_patch() | 18 | monkey_patch() |
1908 | 19 | 19 | ||
1909 | 20 | 20 | ||
1911 | 21 | class LaunchpadFault(xmlrpc_client.Fault): | 21 | class LaunchpadFault(xmlrpc.client.Fault): |
1912 | 22 | """Base class for a Launchpad XMLRPC fault. | 22 | """Base class for a Launchpad XMLRPC fault. |
1913 | 23 | 23 | ||
1914 | 24 | Subclasses should define a unique error_code and a msg_template, | 24 | Subclasses should define a unique error_code and a msg_template, |
1915 | @@ -34,7 +34,7 @@ class LaunchpadFault(xmlrpc_client.Fault): | |||
1916 | 34 | assert self.msg_template is not None, ( | 34 | assert self.msg_template is not None, ( |
1917 | 35 | "Subclasses must define msg_template.") | 35 | "Subclasses must define msg_template.") |
1918 | 36 | msg = self.msg_template % kw | 36 | msg = self.msg_template % kw |
1920 | 37 | xmlrpc_client.Fault.__init__(self, self.error_code, msg) | 37 | xmlrpc.client.Fault.__init__(self, self.error_code, msg) |
1921 | 38 | 38 | ||
1922 | 39 | def __eq__(self, other): | 39 | def __eq__(self, other): |
1923 | 40 | if not isinstance(other, LaunchpadFault): | 40 | if not isinstance(other, LaunchpadFault): |
1924 | @@ -47,19 +47,19 @@ class LaunchpadFault(xmlrpc_client.Fault): | |||
1925 | 47 | return not (self == other) | 47 | return not (self == other) |
1926 | 48 | 48 | ||
1927 | 49 | 49 | ||
1930 | 50 | class Transport(xmlrpc_client.Transport): | 50 | class Transport(xmlrpc.client.Transport): |
1931 | 51 | """An xmlrpc_client transport that supports a timeout argument. | 51 | """An xmlrpc.client transport that supports a timeout argument. |
1932 | 52 | 52 | ||
1933 | 53 | Use by passing into the "transport" argument of the | 53 | Use by passing into the "transport" argument of the |
1935 | 54 | xmlrpc_client.ServerProxy initialization. | 54 | xmlrpc.client.ServerProxy initialization. |
1936 | 55 | """ | 55 | """ |
1937 | 56 | 56 | ||
1938 | 57 | def __init__(self, | 57 | def __init__(self, |
1939 | 58 | use_datetime=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): | 58 | use_datetime=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): |
1941 | 59 | xmlrpc_client.Transport.__init__(self, use_datetime) | 59 | xmlrpc.client.Transport.__init__(self, use_datetime) |
1942 | 60 | self.timeout = timeout | 60 | self.timeout = timeout |
1943 | 61 | 61 | ||
1944 | 62 | def make_connection(self, host): | 62 | def make_connection(self, host): |
1946 | 63 | conn = xmlrpc_client.Transport.make_connection(self, host) | 63 | conn = xmlrpc.client.Transport.make_connection(self, host) |
1947 | 64 | conn.timeout = self.timeout | 64 | conn.timeout = self.timeout |
1948 | 65 | return conn | 65 | return conn |
1949 | diff --git a/lib/lp/soyuz/model/livefsbuildbehaviour.py b/lib/lp/soyuz/model/livefsbuildbehaviour.py | |||
1950 | index acf8999..700e5c0 100644 | |||
1951 | --- a/lib/lp/soyuz/model/livefsbuildbehaviour.py | |||
1952 | +++ b/lib/lp/soyuz/model/livefsbuildbehaviour.py | |||
1953 | @@ -95,7 +95,7 @@ class LiveFSBuildBehaviour(BuildFarmJobBehaviourBase): | |||
1954 | 95 | base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs( | 95 | base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs( |
1955 | 96 | logger=logger) | 96 | logger=logger) |
1956 | 97 | # Non-trivial metadata values may have been security-wrapped, which | 97 | # Non-trivial metadata values may have been security-wrapped, which |
1958 | 98 | # is pointless here and just gets in the way of xmlrpc_client | 98 | # is pointless here and just gets in the way of xmlrpc.client |
1959 | 99 | # serialisation. | 99 | # serialisation. |
1960 | 100 | args = dict(removeSecurityProxy(build.livefs.metadata)) | 100 | args = dict(removeSecurityProxy(build.livefs.metadata)) |
1961 | 101 | if build.metadata_override is not None: | 101 | if build.metadata_override is not None: |
1962 | diff --git a/lib/lp/soyuz/wsgi/archiveauth.py b/lib/lp/soyuz/wsgi/archiveauth.py | |||
1963 | index 19db4a8..dc0dece 100644 | |||
1964 | --- a/lib/lp/soyuz/wsgi/archiveauth.py | |||
1965 | +++ b/lib/lp/soyuz/wsgi/archiveauth.py | |||
1966 | @@ -15,13 +15,13 @@ from random import SystemRandom | |||
1967 | 15 | import string | 15 | import string |
1968 | 16 | import sys | 16 | import sys |
1969 | 17 | import time | 17 | import time |
1973 | 18 | 18 | from xmlrpc.client import ( | |
1971 | 19 | import six | ||
1972 | 20 | from six.moves.xmlrpc_client import ( | ||
1974 | 21 | Fault, | 19 | Fault, |
1975 | 22 | ServerProxy, | 20 | ServerProxy, |
1976 | 23 | ) | 21 | ) |
1977 | 24 | 22 | ||
1978 | 23 | import six | ||
1979 | 24 | |||
1980 | 25 | from lp.services.config import config | 25 | from lp.services.config import config |
1981 | 26 | from lp.services.memcache.client import memcache_client_factory | 26 | from lp.services.memcache.client import memcache_client_factory |
1982 | 27 | 27 | ||
1983 | diff --git a/lib/lp/testing/xmlrpc.py b/lib/lp/testing/xmlrpc.py | |||
1984 | index 644a22d..82ac254 100644 | |||
1985 | --- a/lib/lp/testing/xmlrpc.py | |||
1986 | +++ b/lib/lp/testing/xmlrpc.py | |||
1987 | @@ -9,8 +9,8 @@ __all__ = [ | |||
1988 | 9 | 9 | ||
1989 | 10 | import http.client as http_client | 10 | import http.client as http_client |
1990 | 11 | import io | 11 | import io |
1991 | 12 | import xmlrpc.client | ||
1992 | 12 | 13 | ||
1993 | 13 | from six.moves import xmlrpc_client | ||
1994 | 14 | from zope.security.management import ( | 14 | from zope.security.management import ( |
1995 | 15 | endInteraction, | 15 | endInteraction, |
1996 | 16 | queryInteraction, | 16 | queryInteraction, |
1997 | @@ -38,7 +38,7 @@ class _FakeSocket(object): | |||
1998 | 38 | class TestHTTPConnection(http_client.HTTPConnection): | 38 | class TestHTTPConnection(http_client.HTTPConnection): |
1999 | 39 | """A HTTPConnection which talks to http() instead of a real server. | 39 | """A HTTPConnection which talks to http() instead of a real server. |
2000 | 40 | 40 | ||
2002 | 41 | Only the methods called by xmlrpc_client are overridden. | 41 | Only the methods called by xmlrpc.client are overridden. |
2003 | 42 | """ | 42 | """ |
2004 | 43 | 43 | ||
2005 | 44 | _data_to_send = b'' | 44 | _data_to_send = b'' |
2006 | @@ -76,7 +76,7 @@ class TestHTTPConnection(http_client.HTTPConnection): | |||
2007 | 76 | return response | 76 | return response |
2008 | 77 | 77 | ||
2009 | 78 | 78 | ||
2011 | 79 | class XMLRPCTestTransport(xmlrpc_client.Transport): | 79 | class XMLRPCTestTransport(xmlrpc.client.Transport): |
2012 | 80 | """An XMLRPC Transport which sends the requests to http().""" | 80 | """An XMLRPC Transport which sends the requests to http().""" |
2013 | 81 | 81 | ||
2014 | 82 | def make_connection(self, host): | 82 | def make_connection(self, host): |
2015 | diff --git a/lib/lp/xmlrpc/application.py b/lib/lp/xmlrpc/application.py | |||
2016 | index b855323..1b23765 100644 | |||
2017 | --- a/lib/lp/xmlrpc/application.py | |||
2018 | +++ b/lib/lp/xmlrpc/application.py | |||
2019 | @@ -9,7 +9,8 @@ __all__ = [ | |||
2020 | 9 | 'SelfTest', | 9 | 'SelfTest', |
2021 | 10 | ] | 10 | ] |
2022 | 11 | 11 | ||
2024 | 12 | from six.moves import xmlrpc_client | 12 | import xmlrpc.client |
2025 | 13 | |||
2026 | 13 | from zope.component import getUtility | 14 | from zope.component import getUtility |
2027 | 14 | from zope.interface import ( | 15 | from zope.interface import ( |
2028 | 15 | implementer, | 16 | implementer, |
2029 | @@ -104,7 +105,7 @@ class SelfTest(LaunchpadXMLRPCView): | |||
2030 | 104 | 105 | ||
2031 | 105 | def make_fault(self): | 106 | def make_fault(self): |
2032 | 106 | """Returns an xmlrpc fault.""" | 107 | """Returns an xmlrpc fault.""" |
2034 | 107 | return xmlrpc_client.Fault(666, "Yoghurt and spanners.") | 108 | return xmlrpc.client.Fault(666, "Yoghurt and spanners.") |
2035 | 108 | 109 | ||
2036 | 109 | def concatenate(self, string1, string2): | 110 | def concatenate(self, string1, string2): |
2037 | 110 | """Return the concatenation of the two given strings.""" | 111 | """Return the concatenation of the two given strings.""" |
2038 | diff --git a/lib/lp/xmlrpc/configure.zcml b/lib/lp/xmlrpc/configure.zcml | |||
2039 | index d387eab..a0ed00d 100644 | |||
2040 | --- a/lib/lp/xmlrpc/configure.zcml | |||
2041 | +++ b/lib/lp/xmlrpc/configure.zcml | |||
2042 | @@ -87,148 +87,148 @@ | |||
2043 | 87 | /> | 87 | /> |
2044 | 88 | 88 | ||
2045 | 89 | <class class="lp.xmlrpc.faults.BranchAlreadyRegistered"> | 89 | <class class="lp.xmlrpc.faults.BranchAlreadyRegistered"> |
2047 | 90 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 90 | <require like_class="xmlrpc.client.Fault" /> |
2048 | 91 | </class> | 91 | </class> |
2049 | 92 | 92 | ||
2050 | 93 | <class class="lp.xmlrpc.faults.FileBugGotProductAndDistro"> | 93 | <class class="lp.xmlrpc.faults.FileBugGotProductAndDistro"> |
2052 | 94 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 94 | <require like_class="xmlrpc.client.Fault" /> |
2053 | 95 | </class> | 95 | </class> |
2054 | 96 | 96 | ||
2055 | 97 | <class | 97 | <class |
2056 | 98 | class="lp.xmlrpc.faults.FileBugMissingProductOrDistribution" | 98 | class="lp.xmlrpc.faults.FileBugMissingProductOrDistribution" |
2057 | 99 | > | 99 | > |
2059 | 100 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 100 | <require like_class="xmlrpc.client.Fault" /> |
2060 | 101 | </class> | 101 | </class> |
2061 | 102 | 102 | ||
2062 | 103 | <class class="lp.xmlrpc.faults.NoSuchDistribution"> | 103 | <class class="lp.xmlrpc.faults.NoSuchDistribution"> |
2064 | 104 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 104 | <require like_class="xmlrpc.client.Fault" /> |
2065 | 105 | </class> | 105 | </class> |
2066 | 106 | 106 | ||
2067 | 107 | <class class="lp.xmlrpc.faults.NoSuchPackage"> | 107 | <class class="lp.xmlrpc.faults.NoSuchPackage"> |
2069 | 108 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 108 | <require like_class="xmlrpc.client.Fault" /> |
2070 | 109 | </class> | 109 | </class> |
2071 | 110 | 110 | ||
2072 | 111 | <class class="lp.xmlrpc.faults.NoSuchProduct"> | 111 | <class class="lp.xmlrpc.faults.NoSuchProduct"> |
2074 | 112 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 112 | <require like_class="xmlrpc.client.Fault" /> |
2075 | 113 | </class> | 113 | </class> |
2076 | 114 | 114 | ||
2077 | 115 | <class class="lp.xmlrpc.faults.NoSuchPerson"> | 115 | <class class="lp.xmlrpc.faults.NoSuchPerson"> |
2079 | 116 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 116 | <require like_class="xmlrpc.client.Fault" /> |
2080 | 117 | </class> | 117 | </class> |
2081 | 118 | 118 | ||
2082 | 119 | <class class="lp.xmlrpc.faults.NoSuchPersonWithName"> | 119 | <class class="lp.xmlrpc.faults.NoSuchPersonWithName"> |
2084 | 120 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 120 | <require like_class="xmlrpc.client.Fault" /> |
2085 | 121 | </class> | 121 | </class> |
2086 | 122 | 122 | ||
2087 | 123 | <class class="lp.xmlrpc.faults.NoSuchBranch"> | 123 | <class class="lp.xmlrpc.faults.NoSuchBranch"> |
2089 | 124 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 124 | <require like_class="xmlrpc.client.Fault" /> |
2090 | 125 | </class> | 125 | </class> |
2091 | 126 | 126 | ||
2092 | 127 | <class class="lp.xmlrpc.faults.NoSuchBug"> | 127 | <class class="lp.xmlrpc.faults.NoSuchBug"> |
2094 | 128 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 128 | <require like_class="xmlrpc.client.Fault" /> |
2095 | 129 | </class> | 129 | </class> |
2096 | 130 | 130 | ||
2097 | 131 | <class class="lp.xmlrpc.faults.RequiredParameterMissing"> | 131 | <class class="lp.xmlrpc.faults.RequiredParameterMissing"> |
2099 | 132 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 132 | <require like_class="xmlrpc.client.Fault" /> |
2100 | 133 | </class> | 133 | </class> |
2101 | 134 | 134 | ||
2102 | 135 | <class class="lp.xmlrpc.faults.BranchCreationForbidden"> | 135 | <class class="lp.xmlrpc.faults.BranchCreationForbidden"> |
2104 | 136 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 136 | <require like_class="xmlrpc.client.Fault" /> |
2105 | 137 | </class> | 137 | </class> |
2106 | 138 | 138 | ||
2107 | 139 | <class class="lp.xmlrpc.faults.InvalidBranchUrl"> | 139 | <class class="lp.xmlrpc.faults.InvalidBranchUrl"> |
2109 | 140 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 140 | <require like_class="xmlrpc.client.Fault" /> |
2110 | 141 | </class> | 141 | </class> |
2111 | 142 | 142 | ||
2112 | 143 | <class class="lp.xmlrpc.faults.BranchUniqueNameConflict"> | 143 | <class class="lp.xmlrpc.faults.BranchUniqueNameConflict"> |
2114 | 144 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 144 | <require like_class="xmlrpc.client.Fault" /> |
2115 | 145 | </class> | 145 | </class> |
2116 | 146 | 146 | ||
2117 | 147 | <class class="lp.xmlrpc.faults.NoSuchTeamMailingList"> | 147 | <class class="lp.xmlrpc.faults.NoSuchTeamMailingList"> |
2119 | 148 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 148 | <require like_class="xmlrpc.client.Fault" /> |
2120 | 149 | </class> | 149 | </class> |
2121 | 150 | 150 | ||
2122 | 151 | <class class="lp.xmlrpc.faults.UnexpectedStatusReport"> | 151 | <class class="lp.xmlrpc.faults.UnexpectedStatusReport"> |
2124 | 152 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 152 | <require like_class="xmlrpc.client.Fault" /> |
2125 | 153 | </class> | 153 | </class> |
2126 | 154 | 154 | ||
2127 | 155 | <class class="lp.xmlrpc.faults.BadStatus"> | 155 | <class class="lp.xmlrpc.faults.BadStatus"> |
2129 | 156 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 156 | <require like_class="xmlrpc.client.Fault" /> |
2130 | 157 | </class> | 157 | </class> |
2131 | 158 | 158 | ||
2132 | 159 | <class class="lp.xmlrpc.faults.NoLinkedBranch"> | 159 | <class class="lp.xmlrpc.faults.NoLinkedBranch"> |
2134 | 160 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 160 | <require like_class="xmlrpc.client.Fault" /> |
2135 | 161 | </class> | 161 | </class> |
2136 | 162 | 162 | ||
2137 | 163 | <class class="lp.xmlrpc.faults.NoSuchProductSeries"> | 163 | <class class="lp.xmlrpc.faults.NoSuchProductSeries"> |
2139 | 164 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 164 | <require like_class="xmlrpc.client.Fault" /> |
2140 | 165 | </class> | 165 | </class> |
2141 | 166 | 166 | ||
2142 | 167 | <class class="lp.xmlrpc.faults.InvalidBranchIdentifier"> | 167 | <class class="lp.xmlrpc.faults.InvalidBranchIdentifier"> |
2144 | 168 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 168 | <require like_class="xmlrpc.client.Fault" /> |
2145 | 169 | </class> | 169 | </class> |
2146 | 170 | 170 | ||
2147 | 171 | <class class="lp.xmlrpc.faults.BranchNameInUse"> | 171 | <class class="lp.xmlrpc.faults.BranchNameInUse"> |
2149 | 172 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 172 | <require like_class="xmlrpc.client.Fault" /> |
2150 | 173 | </class> | 173 | </class> |
2151 | 174 | 174 | ||
2152 | 175 | <class class="lp.xmlrpc.faults.CannotHaveLinkedBranch"> | 175 | <class class="lp.xmlrpc.faults.CannotHaveLinkedBranch"> |
2154 | 176 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 176 | <require like_class="xmlrpc.client.Fault" /> |
2155 | 177 | </class> | 177 | </class> |
2156 | 178 | 178 | ||
2157 | 179 | <class class="lp.xmlrpc.faults.InvalidProductName"> | 179 | <class class="lp.xmlrpc.faults.InvalidProductName"> |
2159 | 180 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 180 | <require like_class="xmlrpc.client.Fault" /> |
2160 | 181 | </class> | 181 | </class> |
2161 | 182 | 182 | ||
2162 | 183 | <class class="lp.xmlrpc.faults.NotInTeam"> | 183 | <class class="lp.xmlrpc.faults.NotInTeam"> |
2164 | 184 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 184 | <require like_class="xmlrpc.client.Fault" /> |
2165 | 185 | </class> | 185 | </class> |
2166 | 186 | 186 | ||
2167 | 187 | <class class="lp.xmlrpc.faults.InvalidBranchName"> | 187 | <class class="lp.xmlrpc.faults.InvalidBranchName"> |
2169 | 188 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 188 | <require like_class="xmlrpc.client.Fault" /> |
2170 | 189 | </class> | 189 | </class> |
2171 | 190 | 190 | ||
2172 | 191 | <class class="lp.xmlrpc.faults.NoBranchWithID"> | 191 | <class class="lp.xmlrpc.faults.NoBranchWithID"> |
2174 | 192 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 192 | <require like_class="xmlrpc.client.Fault" /> |
2175 | 193 | </class> | 193 | </class> |
2176 | 194 | 194 | ||
2177 | 195 | <class class="lp.xmlrpc.faults.NoUrlForBranch"> | 195 | <class class="lp.xmlrpc.faults.NoUrlForBranch"> |
2179 | 196 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 196 | <require like_class="xmlrpc.client.Fault" /> |
2180 | 197 | </class> | 197 | </class> |
2181 | 198 | 198 | ||
2182 | 199 | <class class="lp.xmlrpc.faults.PathTranslationError"> | 199 | <class class="lp.xmlrpc.faults.PathTranslationError"> |
2184 | 200 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 200 | <require like_class="xmlrpc.client.Fault" /> |
2185 | 201 | </class> | 201 | </class> |
2186 | 202 | 202 | ||
2187 | 203 | <class class="lp.xmlrpc.faults.InvalidPath"> | 203 | <class class="lp.xmlrpc.faults.InvalidPath"> |
2189 | 204 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 204 | <require like_class="xmlrpc.client.Fault" /> |
2190 | 205 | </class> | 205 | </class> |
2191 | 206 | 206 | ||
2192 | 207 | <class class="lp.xmlrpc.faults.PermissionDenied"> | 207 | <class class="lp.xmlrpc.faults.PermissionDenied"> |
2194 | 208 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 208 | <require like_class="xmlrpc.client.Fault" /> |
2195 | 209 | </class> | 209 | </class> |
2196 | 210 | 210 | ||
2197 | 211 | <class class="lp.xmlrpc.faults.NotFound"> | 211 | <class class="lp.xmlrpc.faults.NotFound"> |
2199 | 212 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 212 | <require like_class="xmlrpc.client.Fault" /> |
2200 | 213 | </class> | 213 | </class> |
2201 | 214 | 214 | ||
2202 | 215 | <class class="lp.xmlrpc.faults.InvalidBranchUniqueName"> | 215 | <class class="lp.xmlrpc.faults.InvalidBranchUniqueName"> |
2204 | 216 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 216 | <require like_class="xmlrpc.client.Fault" /> |
2205 | 217 | </class> | 217 | </class> |
2206 | 218 | 218 | ||
2207 | 219 | <class class="lp.xmlrpc.faults.NoSuchDistroSeries"> | 219 | <class class="lp.xmlrpc.faults.NoSuchDistroSeries"> |
2209 | 220 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 220 | <require like_class="xmlrpc.client.Fault" /> |
2210 | 221 | </class> | 221 | </class> |
2211 | 222 | 222 | ||
2212 | 223 | <class class="lp.xmlrpc.faults.NoSuchSourcePackageName"> | 223 | <class class="lp.xmlrpc.faults.NoSuchSourcePackageName"> |
2214 | 224 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 224 | <require like_class="xmlrpc.client.Fault" /> |
2215 | 225 | </class> | 225 | </class> |
2216 | 226 | 226 | ||
2217 | 227 | <class class="lp.xmlrpc.faults.InvalidSourcePackageName"> | 227 | <class class="lp.xmlrpc.faults.InvalidSourcePackageName"> |
2219 | 228 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 228 | <require like_class="xmlrpc.client.Fault" /> |
2220 | 229 | </class> | 229 | </class> |
2221 | 230 | 230 | ||
2222 | 231 | <class class="lp.xmlrpc.faults.Unauthorized"> | 231 | <class class="lp.xmlrpc.faults.Unauthorized"> |
2224 | 232 | <require like_class="six.moves.xmlrpc_client.Fault" /> | 232 | <require like_class="xmlrpc.client.Fault" /> |
2225 | 233 | </class> | 233 | </class> |
2226 | 234 | </configure> | 234 | </configure> |
2227 | diff --git a/lib/lp/xmlrpc/helpers.py b/lib/lp/xmlrpc/helpers.py | |||
2228 | index e990af9..f2c7397 100644 | |||
2229 | --- a/lib/lp/xmlrpc/helpers.py | |||
2230 | +++ b/lib/lp/xmlrpc/helpers.py | |||
2231 | @@ -7,7 +7,8 @@ __all__ = [ | |||
2232 | 7 | 'return_fault', | 7 | 'return_fault', |
2233 | 8 | ] | 8 | ] |
2234 | 9 | 9 | ||
2236 | 10 | from six.moves.xmlrpc_client import Fault | 10 | from xmlrpc.client import Fault |
2237 | 11 | |||
2238 | 11 | from twisted.python.util import mergeFunctionMetadata | 12 | from twisted.python.util import mergeFunctionMetadata |
2239 | 12 | 13 | ||
2240 | 13 | 14 | ||
2241 | diff --git a/lib/lp/xmlrpc/tests/test_private_xmlrpc.py b/lib/lp/xmlrpc/tests/test_private_xmlrpc.py | |||
2242 | index c20d180..7215a23 100644 | |||
2243 | --- a/lib/lp/xmlrpc/tests/test_private_xmlrpc.py | |||
2244 | +++ b/lib/lp/xmlrpc/tests/test_private_xmlrpc.py | |||
2245 | @@ -4,7 +4,8 @@ | |||
2246 | 4 | """Private XMLRPC tests. | 4 | """Private XMLRPC tests. |
2247 | 5 | """ | 5 | """ |
2248 | 6 | 6 | ||
2250 | 7 | from six.moves import xmlrpc_client | 7 | import xmlrpc.client |
2251 | 8 | |||
2252 | 8 | from zope.component import getUtility | 9 | from zope.component import getUtility |
2253 | 9 | 10 | ||
2254 | 10 | from lp.services.verification.interfaces.logintoken import ILoginTokenSet | 11 | from lp.services.verification.interfaces.logintoken import ILoginTokenSet |
2255 | @@ -30,14 +31,14 @@ class TestPrivateXMLRPC(TestCase): | |||
2256 | 30 | private_root = 'http://xmlrpc-private.launchpad.test:8087/' | 31 | private_root = 'http://xmlrpc-private.launchpad.test:8087/' |
2257 | 31 | 32 | ||
2258 | 32 | def get_public_proxy(self, path): | 33 | def get_public_proxy(self, path): |
2261 | 33 | """Get an xmlrpc_client.ServerProxy pointing at the public URL""" | 34 | """Get an xmlrpc.client.ServerProxy pointing at the public URL""" |
2262 | 34 | return xmlrpc_client.ServerProxy( | 35 | return xmlrpc.client.ServerProxy( |
2263 | 35 | self.public_root + path, | 36 | self.public_root + path, |
2264 | 36 | transport=XMLRPCTestTransport()) | 37 | transport=XMLRPCTestTransport()) |
2265 | 37 | 38 | ||
2266 | 38 | def get_private_proxy(self, path): | 39 | def get_private_proxy(self, path): |
2269 | 39 | """Get an xmlrpc_client.ServerProxy pointing at the private URL""" | 40 | """Get an xmlrpc.client.ServerProxy pointing at the private URL""" |
2270 | 40 | return xmlrpc_client.ServerProxy( | 41 | return xmlrpc.client.ServerProxy( |
2271 | 41 | self.private_root + path, | 42 | self.private_root + path, |
2272 | 42 | transport=XMLRPCTestTransport()) | 43 | transport=XMLRPCTestTransport()) |
2273 | 43 | 44 | ||
2274 | @@ -47,7 +48,7 @@ class TestPrivateXMLRPC(TestCase): | |||
2275 | 47 | not available on the external XML-RPC port. | 48 | not available on the external XML-RPC port. |
2276 | 48 | """ | 49 | """ |
2277 | 49 | external_api = self.get_public_proxy('mailinglists/') | 50 | external_api = self.get_public_proxy('mailinglists/') |
2279 | 50 | e = self.assertRaises(xmlrpc_client.ProtocolError, | 51 | e = self.assertRaises(xmlrpc.client.ProtocolError, |
2280 | 51 | external_api.getPendingActions) | 52 | external_api.getPendingActions) |
2281 | 52 | self.assertEqual(404, e.errcode) | 53 | self.assertEqual(404, e.errcode) |
2282 | 53 | 54 | ||
2283 | @@ -77,7 +78,7 @@ class TestPrivateXMLRPC(TestCase): | |||
2284 | 77 | internal_api = self.get_private_proxy('bugs/') | 78 | internal_api = self.get_private_proxy('bugs/') |
2285 | 78 | bug_dict = dict( | 79 | bug_dict = dict( |
2286 | 79 | product='firefox', summary='the summary', comment='the comment') | 80 | product='firefox', summary='the summary', comment='the comment') |
2288 | 80 | e = self.assertRaises(xmlrpc_client.ProtocolError, | 81 | e = self.assertRaises(xmlrpc.client.ProtocolError, |
2289 | 81 | internal_api.filebug, bug_dict) | 82 | internal_api.filebug, bug_dict) |
2290 | 82 | self.assertEqual(404, e.errcode) | 83 | self.assertEqual(404, e.errcode) |
2291 | 83 | 84 | ||
2292 | diff --git a/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py b/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py | |||
2293 | index 4c005eb..9f0d528 100644 | |||
2294 | --- a/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py | |||
2295 | +++ b/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py | |||
2296 | @@ -4,7 +4,8 @@ | |||
2297 | 4 | """XMLRPC self-test api. | 4 | """XMLRPC self-test api. |
2298 | 5 | """ | 5 | """ |
2299 | 6 | 6 | ||
2301 | 7 | from six.moves import xmlrpc_client | 7 | import xmlrpc.client |
2302 | 8 | |||
2303 | 8 | from zope.component import getUtility | 9 | from zope.component import getUtility |
2304 | 9 | 10 | ||
2305 | 10 | from lp.services.webapp.interfaces import ILaunchBag | 11 | from lp.services.webapp.interfaces import ILaunchBag |
2306 | @@ -27,11 +28,11 @@ class TestXMLRPCSelfTest(TestCaseWithFactory): | |||
2307 | 27 | layer = LaunchpadFunctionalLayer | 28 | layer = LaunchpadFunctionalLayer |
2308 | 28 | 29 | ||
2309 | 29 | def make_proxy(self): | 30 | def make_proxy(self): |
2311 | 30 | return xmlrpc_client.ServerProxy( | 31 | return xmlrpc.client.ServerProxy( |
2312 | 31 | 'http://xmlrpc.launchpad.test/', transport=XMLRPCTestTransport()) | 32 | 'http://xmlrpc.launchpad.test/', transport=XMLRPCTestTransport()) |
2313 | 32 | 33 | ||
2314 | 33 | def make_logged_in_proxy(self): | 34 | def make_logged_in_proxy(self): |
2316 | 34 | return xmlrpc_client.ServerProxy( | 35 | return xmlrpc.client.ServerProxy( |
2317 | 35 | 'http://test@canonical.com:test@xmlrpc.launchpad.test/', | 36 | 'http://test@canonical.com:test@xmlrpc.launchpad.test/', |
2318 | 36 | transport=XMLRPCTestTransport()) | 37 | transport=XMLRPCTestTransport()) |
2319 | 37 | 38 | ||
2320 | @@ -46,17 +47,17 @@ class TestXMLRPCSelfTest(TestCaseWithFactory): | |||
2321 | 46 | self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault)) | 47 | self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault)) |
2322 | 47 | 48 | ||
2323 | 48 | def test_custom_transport(self): | 49 | def test_custom_transport(self): |
2325 | 49 | """We can test our XMLRPC APIs using xmlrpc_client, using a custom | 50 | """We can test our XMLRPC APIs using xmlrpc.client, using a custom |
2326 | 50 | Transport which talks with the publisher directly. | 51 | Transport which talks with the publisher directly. |
2327 | 51 | """ | 52 | """ |
2328 | 52 | selftest = self.make_proxy() | 53 | selftest = self.make_proxy() |
2329 | 53 | self.assertEqual('foo bar', selftest.concatenate('foo', 'bar')) | 54 | self.assertEqual('foo bar', selftest.concatenate('foo', 'bar')) |
2331 | 54 | fault = self.assertRaises(xmlrpc_client.Fault, selftest.make_fault) | 55 | fault = self.assertRaises(xmlrpc.client.Fault, selftest.make_fault) |
2332 | 55 | self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault)) | 56 | self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault)) |
2333 | 56 | 57 | ||
2334 | 57 | def test_unexpected_exception(self): | 58 | def test_unexpected_exception(self): |
2335 | 58 | """Sometimes an XML-RPC method will be buggy, and raise an exception | 59 | """Sometimes an XML-RPC method will be buggy, and raise an exception |
2337 | 59 | other than xmlrpc_client.Fault. We have such a method on the self | 60 | other than xmlrpc.client.Fault. We have such a method on the self |
2338 | 60 | test view. | 61 | test view. |
2339 | 61 | """ | 62 | """ |
2340 | 62 | selftestview = SelfTest('somecontext', 'somerequest') | 63 | selftestview = SelfTest('somecontext', 'somerequest') |
2341 | @@ -69,7 +70,7 @@ class TestXMLRPCSelfTest(TestCaseWithFactory): | |||
2342 | 69 | one was generated): | 70 | one was generated): |
2343 | 70 | """ | 71 | """ |
2344 | 71 | selftest = self.make_proxy() | 72 | selftest = self.make_proxy() |
2346 | 72 | e = self.assertRaises(xmlrpc_client.Fault, selftest.raise_exception) | 73 | e = self.assertRaises(xmlrpc.client.Fault, selftest.raise_exception) |
2347 | 73 | self.assertStartsWith(str(e), "<Fault -1: 'OOPS-") | 74 | self.assertStartsWith(str(e), "<Fault -1: 'OOPS-") |
2348 | 74 | 75 | ||
2349 | 75 | def test_anonymous_authentication(self): | 76 | def test_anonymous_authentication(self): |
I'll take a look throughout the day - will take some time, obviously :-)