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 | import logging |
7 | import os |
8 | import threading |
9 | +import xmlrpc.client |
10 | |
11 | from breezy import ( |
12 | errors, |
13 | @@ -40,7 +41,6 @@ from paste.request import ( |
14 | path_info_pop, |
15 | ) |
16 | import six |
17 | -from six.moves import xmlrpc_client |
18 | from six.moves.urllib.parse import ( |
19 | urlencode, |
20 | urljoin, |
21 | @@ -72,7 +72,7 @@ thread_locals = threading.local() |
22 | def check_fault(fault, *fault_classes): |
23 | """Check if 'fault's faultCode matches any of 'fault_classes'. |
24 | |
25 | - :param fault: An instance of `xmlrpc_client.Fault`. |
26 | + :param fault: An instance of `xmlrpc.client.Fault`. |
27 | :param fault_classes: Any number of `LaunchpadFault` subclasses. |
28 | """ |
29 | for cls in fault_classes: |
30 | @@ -98,7 +98,7 @@ class RootApp: |
31 | def get_branchfs(self): |
32 | t = getattr(thread_locals, 'branchfs', None) |
33 | if t is None: |
34 | - thread_locals.branchfs = xmlrpc_client.ServerProxy( |
35 | + thread_locals.branchfs = xmlrpc.client.ServerProxy( |
36 | config.codehosting.codehosting_endpoint) |
37 | return thread_locals.branchfs |
38 | |
39 | @@ -221,7 +221,7 @@ class RootApp: |
40 | branchfs = self.get_branchfs() |
41 | transport_type, info, trail = branchfs.translatePath( |
42 | identity_url, urlutils.escape(path)) |
43 | - except xmlrpc_client.Fault as f: |
44 | + except xmlrpc.client.Fault as f: |
45 | if check_fault(f, faults.PathTranslationError): |
46 | raise HTTPNotFound() |
47 | 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 | We make Zope 3 give us real time statistics about Launchpad's operation. |
54 | We can access them via XML-RPC: |
55 | |
56 | - >>> from six.moves import xmlrpc_client |
57 | + >>> import xmlrpc.client |
58 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
59 | - >>> lp_xmlrpc = xmlrpc_client.ServerProxy( |
60 | + >>> lp_xmlrpc = xmlrpc.client.ServerProxy( |
61 | ... 'http://xmlrpc.launchpad.test/+opstats', |
62 | ... transport=XMLRPCTestTransport() |
63 | ... ) |
64 | @@ -192,7 +192,7 @@ Number of XML-RPC Faults |
65 | ... try: |
66 | ... opstats = lp_xmlrpc.invalid() # XXX: Need a HTTP test too |
67 | ... print('Should have raised a Fault exception!') |
68 | - ... except xmlrpc_client.Fault: |
69 | + ... except xmlrpc.client.Fault: |
70 | ... pass |
71 | >>> report() |
72 | 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 | |
79 | Launchpad offers an XML-RPC interface for generating bug tracker tokens. |
80 | |
81 | - >>> from six.moves import xmlrpc_client |
82 | + >>> import xmlrpc.client |
83 | >>> from zope.component import getUtility |
84 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
85 | >>> from lp.services.verification.interfaces.logintoken import ( |
86 | ... ILoginTokenSet) |
87 | - >>> bugtracker_api = xmlrpc_client.ServerProxy( |
88 | + >>> bugtracker_api = xmlrpc.client.ServerProxy( |
89 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', |
90 | ... transport=XMLRPCTestTransport()) |
91 | |
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 | |
98 | If authentication fails, a BugTrackerAuthenticationError will be raised. |
99 | |
100 | - >>> from six.moves.xmlrpc_client import Fault, ProtocolError |
101 | + >>> from xmlrpc.client import Fault, ProtocolError |
102 | >>> class TestAuthFailingBugzillaXMLRPCTransport( |
103 | ... ZopelessBugzillaXMLRPCTransport): |
104 | ... 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 | The Bugzilla ExternalBugTracker has a _test_xmlrpc_proxy property which |
111 | we override for the purpose of this test. |
112 | |
113 | - >>> from six.moves import xmlrpc_client |
114 | - >>> class FailingXMLRPCTransport(xmlrpc_client.Transport): |
115 | + >>> import xmlrpc.client |
116 | + >>> class FailingXMLRPCTransport(xmlrpc.client.Transport): |
117 | ... |
118 | - ... error = xmlrpc_client.Fault( |
119 | - ... xmlrpc_client.METHOD_NOT_FOUND, "Method doesn't exist") |
120 | + ... error = xmlrpc.client.Fault( |
121 | + ... xmlrpc.client.METHOD_NOT_FOUND, "Method doesn't exist") |
122 | ... |
123 | ... def request(self, host, handler, request, verbose=None): |
124 | ... if self.error is not None: |
125 | ... raise self.error |
126 | ... else: |
127 | ... # We need to return something here, otherwise |
128 | - ... # xmlrpc_client will explode. |
129 | + ... # xmlrpc.client will explode. |
130 | ... return '0.42-test' |
131 | ... |
132 | >>> test_transport = FailingXMLRPCTransport() |
133 | |
134 | >>> class BugzillaWithFakeProxy(Bugzilla): |
135 | ... |
136 | - ... _test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
137 | + ... _test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
138 | ... 'http://example.com/xmlrpc.cgi', transport=test_transport) |
139 | |
140 | >>> bugzilla = BugzillaWithFakeProxy('http://example.com') |
141 | @@ -129,7 +129,7 @@ BugzillaAPI instance. |
142 | The same is true if getExternalBugTrackerToUse() receives a 404 error |
143 | from the remote server. |
144 | |
145 | - >>> test_transport.error = xmlrpc_client.ProtocolError( |
146 | + >>> test_transport.error = xmlrpc.client.ProtocolError( |
147 | ... 'http://example.com/xmlrpc.cgi', 404, 'Not Found', None) |
148 | |
149 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() |
150 | @@ -141,7 +141,7 @@ from the remote server. |
151 | Some Bugzillas respond to an invalid XML-RPC method call by returning a |
152 | 500 error. getExternalBugTrackerToUse() handles those, too. |
153 | |
154 | - >>> test_transport.error = xmlrpc_client.ProtocolError( |
155 | + >>> test_transport.error = xmlrpc.client.ProtocolError( |
156 | ... 'http://example.com/xmlrpc.cgi', 500, 'Server Error', None) |
157 | |
158 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() |
159 | @@ -153,7 +153,7 @@ Some Bugzillas respond to an invalid XML-RPC method call by returning a |
160 | Some other Bugzillas generate an unparsable response, causing |
161 | ResponseError to be raised. |
162 | |
163 | - >>> test_transport.error = xmlrpc_client.ResponseError() |
164 | + >>> test_transport.error = xmlrpc.client.ResponseError() |
165 | >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse() |
166 | |
167 | >>> (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 | BuzillaAPI will be returned. To test this, we use a specially-crafted |
170 | XML-RPC proxy that behaves like a Bugzilla 3.4 instance. |
171 | |
172 | - >>> class APIXMLRPCTransport(xmlrpc_client.Transport): |
173 | + >>> class APIXMLRPCTransport(xmlrpc.client.Transport): |
174 | ... |
175 | ... version = '3.4.2' |
176 | ... |
177 | ... def request(self, host, handler, request, verbose=None): |
178 | - ... args, method_name = xmlrpc_client.loads(request) |
179 | + ... args, method_name = xmlrpc.client.loads(request) |
180 | ... |
181 | ... if method_name == 'Bugzilla.version': |
182 | ... return [{'version': self.version}] |
183 | ... else: |
184 | - ... raise xmlrpc_client.Fault( |
185 | - ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method') |
186 | + ... raise xmlrpc.client.Fault( |
187 | + ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method') |
188 | ... |
189 | >>> test_transport = APIXMLRPCTransport() |
190 | |
191 | - >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
192 | + >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
193 | ... 'http://example.com/xmlrpc.cgi', |
194 | ... transport=test_transport) |
195 | |
196 | @@ -193,7 +193,7 @@ A version older than 3.4 is not accepted. |
197 | >>> test_transport = APIXMLRPCTransport() |
198 | >>> test_transport.version = '3.3' |
199 | |
200 | - >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
201 | + >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
202 | ... 'http://example.com/xmlrpc.cgi', |
203 | ... transport=test_transport) |
204 | |
205 | @@ -206,7 +206,7 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted. |
206 | >>> test_transport = APIXMLRPCTransport() |
207 | >>> test_transport.version = '20181108.1' |
208 | |
209 | - >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
210 | + >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
211 | ... 'http://example.com/xmlrpc.cgi', |
212 | ... transport=test_transport) |
213 | |
214 | @@ -218,20 +218,20 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted. |
215 | If the remote system has the Launchpad plugin installed, an |
216 | getExternalBugTrackerToUse() will return a BugzillaLPPlugin instance. |
217 | |
218 | - >>> class PluginXMLRPCTransport(xmlrpc_client.Transport): |
219 | + >>> class PluginXMLRPCTransport(xmlrpc.client.Transport): |
220 | ... |
221 | ... def request(self, host, handler, request, verbose=None): |
222 | - ... args, method_name = xmlrpc_client.loads(request) |
223 | + ... args, method_name = xmlrpc.client.loads(request) |
224 | ... |
225 | ... if method_name == 'Launchpad.plugin_version': |
226 | ... return [{'version': '0.2'}] |
227 | ... else: |
228 | - ... raise xmlrpc_client.Fault( |
229 | - ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method') |
230 | + ... raise xmlrpc.client.Fault( |
231 | + ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method') |
232 | ... |
233 | >>> test_transport = PluginXMLRPCTransport() |
234 | |
235 | - >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
236 | + >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
237 | ... 'http://example.com/xmlrpc.cgi', |
238 | ... transport=test_transport) |
239 | |
240 | @@ -244,19 +244,19 @@ in response to XML-RPC calls. When something other than a mapping is |
241 | returned, the standard non-API non-plugin external bug tracker is |
242 | selected. |
243 | |
244 | - >>> class OldXMLRPCTransport(xmlrpc_client.Transport): |
245 | + >>> class OldXMLRPCTransport(xmlrpc.client.Transport): |
246 | ... def request(self, host, handler, request, verbose=None): |
247 | - ... args, method_name = xmlrpc_client.loads(request) |
248 | + ... args, method_name = xmlrpc.client.loads(request) |
249 | ... |
250 | ... if method_name == 'Bugzilla.version': |
251 | ... return ('versionResponse', {'version': '3.2.5+'}) |
252 | ... else: |
253 | - ... raise xmlrpc_client.Fault( |
254 | - ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method') |
255 | + ... raise xmlrpc.client.Fault( |
256 | + ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method') |
257 | ... |
258 | >>> test_transport = OldXMLRPCTransport() |
259 | |
260 | - >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
261 | + >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
262 | ... 'http://example.com/xmlrpc.cgi', |
263 | ... transport=test_transport) |
264 | |
265 | @@ -270,18 +270,18 @@ is not discovered over XML-RPC. It's not clear if this is an error in |
266 | Bugzilla or in and XML-RPC library used by Bugzilla. In any case, we |
267 | recognize and treat it the same as METHOD_NOT_FOUND. |
268 | |
269 | - >>> class OldBrokenXMLRPCTransport(xmlrpc_client.Transport): |
270 | + >>> class OldBrokenXMLRPCTransport(xmlrpc.client.Transport): |
271 | ... def request(self, host, handler, request, verbose=None): |
272 | - ... args, method_name = xmlrpc_client.loads(request) |
273 | + ... args, method_name = xmlrpc.client.loads(request) |
274 | ... |
275 | ... if method_name == 'Bugzilla.version': |
276 | ... return ('versionResponse', {'version': '3.2.5+'}) |
277 | ... else: |
278 | - ... raise xmlrpc_client.Fault('Client', 'No such method') |
279 | + ... raise xmlrpc.client.Fault('Client', 'No such method') |
280 | ... |
281 | >>> test_transport = OldBrokenXMLRPCTransport() |
282 | |
283 | - >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
284 | + >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
285 | ... 'http://example.com/xmlrpc.cgi', |
286 | ... transport=test_transport) |
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 | |
294 | Malone provides an XML-RPC interface for filing bugs. |
295 | |
296 | - >>> from six.moves import xmlrpc_client |
297 | + >>> import xmlrpc.client |
298 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
299 | - >>> filebug_api = xmlrpc_client.ServerProxy( |
300 | + >>> filebug_api = xmlrpc.client.ServerProxy( |
301 | ... 'http://test@canonical.com:test@xmlrpc.launchpad.test/bugs/', |
302 | ... transport=XMLRPCTestTransport()) |
303 | |
304 | @@ -278,7 +278,7 @@ The LoginToken generated will be of the LoginTokenType BUGTRACKER. |
305 | |
306 | These requests are all handled by the private xml-rpc server. |
307 | |
308 | - >>> bugtracker_api = xmlrpc_client.ServerProxy( |
309 | + >>> bugtracker_api = xmlrpc.client.ServerProxy( |
310 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', |
311 | ... transport=XMLRPCTestTransport()) |
312 | |
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 | from http.client import BadStatusLine |
319 | import re |
320 | import xml.parsers.expat |
321 | +import xmlrpc.client |
322 | |
323 | from defusedxml import minidom |
324 | import pytz |
325 | import requests |
326 | import six |
327 | -from six.moves import xmlrpc_client |
328 | from zope.component import getUtility |
329 | from zope.interface import ( |
330 | alsoProvides, |
331 | @@ -90,15 +90,15 @@ class Bugzilla(ExternalBugTracker): |
332 | # We try calling Bugzilla.version() on the remote |
333 | # server because it's the most lightweight method there is. |
334 | remote_version = proxy.Bugzilla.version() |
335 | - except xmlrpc_client.Fault as fault: |
336 | + except xmlrpc.client.Fault as fault: |
337 | # 'Client' is a hangover. Either Bugzilla or the Perl |
338 | # XML-RPC lib in use returned it as faultCode. It's wrong, |
339 | # but it's known wrongness, so we recognize it here. |
340 | - if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'): |
341 | + if fault.faultCode in (xmlrpc.client.METHOD_NOT_FOUND, 'Client'): |
342 | return False |
343 | else: |
344 | raise |
345 | - except xmlrpc_client.ProtocolError as error: |
346 | + except xmlrpc.client.ProtocolError as error: |
347 | # We catch 404s, which occur when xmlrpc.cgi doesn't exist |
348 | # on the remote server, and 500s, which sometimes occur when |
349 | # an invalid request is made to the remote server. We allow |
350 | @@ -107,7 +107,7 @@ class Bugzilla(ExternalBugTracker): |
351 | return False |
352 | else: |
353 | raise |
354 | - except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError): |
355 | + except (xmlrpc.client.ResponseError, xml.parsers.expat.ExpatError): |
356 | # The server returned an unparsable response. |
357 | return False |
358 | else: |
359 | @@ -132,15 +132,15 @@ class Bugzilla(ExternalBugTracker): |
360 | # We try calling Launchpad.plugin_version() on the remote |
361 | # server because it's the most lightweight method there is. |
362 | proxy.Launchpad.plugin_version() |
363 | - except xmlrpc_client.Fault as fault: |
364 | + except xmlrpc.client.Fault as fault: |
365 | # 'Client' is a hangover. Either Bugzilla or the Perl |
366 | # XML-RPC lib in use returned it as faultCode. It's wrong, |
367 | # but it's known wrongness, so we recognize it here. |
368 | - if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'): |
369 | + if fault.faultCode in (xmlrpc.client.METHOD_NOT_FOUND, 'Client'): |
370 | return False |
371 | else: |
372 | raise |
373 | - except xmlrpc_client.ProtocolError as error: |
374 | + except xmlrpc.client.ProtocolError as error: |
375 | # We catch 404s, which occur when xmlrpc.cgi doesn't exist |
376 | # on the remote server, and 500s, which sometimes occur when |
377 | # the Launchpad Plugin isn't installed. Everything else we |
378 | @@ -150,7 +150,7 @@ class Bugzilla(ExternalBugTracker): |
379 | return False |
380 | else: |
381 | raise |
382 | - except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError): |
383 | + except (xmlrpc.client.ResponseError, xml.parsers.expat.ExpatError): |
384 | # The server returned an unparsable response. |
385 | return False |
386 | else: |
387 | @@ -169,7 +169,7 @@ class Bugzilla(ExternalBugTracker): |
388 | return BugzillaLPPlugin(self.baseurl) |
389 | elif self._remoteSystemHasBugzillaAPI(): |
390 | return BugzillaAPI(self.baseurl) |
391 | - except (xmlrpc_client.ProtocolError, requests.RequestException, |
392 | + except (xmlrpc.client.ProtocolError, requests.RequestException, |
393 | BadStatusLine): |
394 | pass |
395 | return self |
396 | @@ -538,14 +538,14 @@ class Bugzilla(ExternalBugTracker): |
397 | def needs_authentication(func): |
398 | """Decorator for automatically authenticating if needed. |
399 | |
400 | - If an `xmlrpc_client.Fault` with error code 410 is raised by the |
401 | + If an `xmlrpc.client.Fault` with error code 410 is raised by the |
402 | function, we'll try to authenticate and call the function again. |
403 | """ |
404 | |
405 | def decorator(self, *args, **kwargs): |
406 | try: |
407 | return func(self, *args, **kwargs) |
408 | - except xmlrpc_client.Fault as fault: |
409 | + except xmlrpc.client.Fault as fault: |
410 | # Catch authentication errors only. |
411 | if fault.faultCode != 410: |
412 | raise |
413 | @@ -587,8 +587,8 @@ class BugzillaAPI(Bugzilla): |
414 | |
415 | @property |
416 | def xmlrpc_proxy(self): |
417 | - """Return an `xmlrpc_client.ServerProxy` to self.xmlrpc_endpoint.""" |
418 | - return xmlrpc_client.ServerProxy( |
419 | + """Return an `xmlrpc.client.ServerProxy` to self.xmlrpc_endpoint.""" |
420 | + return xmlrpc.client.ServerProxy( |
421 | self.xmlrpc_endpoint, transport=self.xmlrpc_transport) |
422 | |
423 | @property |
424 | @@ -622,7 +622,7 @@ class BugzillaAPI(Bugzilla): |
425 | """ |
426 | try: |
427 | self.xmlrpc_proxy.User.login(self.credentials) |
428 | - except xmlrpc_client.Fault as fault: |
429 | + except xmlrpc.client.Fault as fault: |
430 | raise BugTrackerAuthenticationError( |
431 | self.baseurl, |
432 | "Fault %s: %s" % (fault.faultCode, fault.faultString)) |
433 | @@ -972,7 +972,7 @@ class BugzillaLPPlugin(BugzillaAPI): |
434 | Bugzilla_logincookie, which we can then use to re-authenticate |
435 | ourselves for each subsequent method call. |
436 | """ |
437 | - internal_xmlrpc_server = xmlrpc_client.ServerProxy( |
438 | + internal_xmlrpc_server = xmlrpc.client.ServerProxy( |
439 | config.checkwatches.xmlrpc_url, |
440 | transport=self.internal_xmlrpc_transport) |
441 | |
442 | @@ -981,12 +981,12 @@ class BugzillaLPPlugin(BugzillaAPI): |
443 | try: |
444 | self.xmlrpc_proxy.Launchpad.login( |
445 | {'token': token_text}) |
446 | - except xmlrpc_client.Fault as fault: |
447 | + except xmlrpc.client.Fault as fault: |
448 | message = 'XML-RPC Fault: %s "%s"' % ( |
449 | fault.faultCode, fault.faultString) |
450 | raise BugTrackerAuthenticationError( |
451 | self.baseurl, message) |
452 | - except xmlrpc_client.ProtocolError as error: |
453 | + except xmlrpc.client.ProtocolError as error: |
454 | message = 'Protocol error: %s "%s"' % ( |
455 | error.errcode, error.errmsg) |
456 | 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 | """Tests for the Bugzilla BugTracker.""" |
463 | |
464 | from xml.parsers.expat import ExpatError |
465 | +import xmlrpc.client |
466 | |
467 | import responses |
468 | -from six.moves import xmlrpc_client |
469 | import transaction |
470 | |
471 | from lp.bugs.externalbugtracker.base import UnparsableBugData |
472 | @@ -71,11 +71,11 @@ class TestBugzillaSniffing(TestCase): |
473 | # it is taken to mean that no XML-RPC capabilities exist. |
474 | bugzilla = Bugzilla("http://not.real") |
475 | |
476 | - class Transport(xmlrpc_client.Transport): |
477 | + class Transport(xmlrpc.client.Transport): |
478 | def request(self, host, handler, request, verbose=None): |
479 | raise ExpatError("mismatched tag") |
480 | |
481 | - bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy( |
482 | + bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy( |
483 | '%s/xmlrpc.cgi' % bugzilla.baseurl, transport=Transport()) |
484 | |
485 | # 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 | |
492 | @responses.activate |
493 | def test_expat_error(self): |
494 | - # Malformed XML-RPC responses cause xmlrpc_client to raise an |
495 | + # Malformed XML-RPC responses cause xmlrpc.client to raise an |
496 | # ExpatError. |
497 | responses.add( |
498 | "POST", "http://www.example.com/xmlrpc", |
499 | @@ -28,7 +28,7 @@ class TestRequestsTransport(TestCase): |
500 | transport = RequestsTransport("http://not.real/") |
501 | |
502 | # The Launchpad production environment selects Expat at present. This |
503 | - # is quite strict compared to the other parsers that xmlrpc_client |
504 | + # is quite strict compared to the other parsers that xmlrpc.client |
505 | # can possibly select. |
506 | ensure_response_parser_is_expat(transport) |
507 | |
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 | from datetime import datetime |
514 | from email.utils import parseaddr |
515 | import time |
516 | +import xmlrpc.client |
517 | |
518 | import pytz |
519 | import requests |
520 | from requests.cookies import RequestsCookieJar |
521 | -from six.moves import xmlrpc_client |
522 | from zope.component import getUtility |
523 | from zope.interface import implementer |
524 | |
525 | @@ -305,14 +305,14 @@ class Trac(ExternalBugTracker): |
526 | def needs_authentication(func): |
527 | """Decorator for automatically authenticating if needed. |
528 | |
529 | - If an `xmlrpc_client.ProtocolError` with error code 403 is raised by the |
530 | + If an `xmlrpc.client.ProtocolError` with error code 403 is raised by the |
531 | function, we'll try to authenticate and call the function again. |
532 | """ |
533 | |
534 | def decorator(self, *args, **kwargs): |
535 | try: |
536 | return func(self, *args, **kwargs) |
537 | - except xmlrpc_client.ProtocolError as error: |
538 | + except xmlrpc.client.ProtocolError as error: |
539 | # Catch authentication errors only. |
540 | if error.errcode != 403: |
541 | raise |
542 | @@ -340,7 +340,7 @@ class TracLPPlugin(Trac): |
543 | self._internal_xmlrpc_transport = internal_xmlrpc_transport |
544 | |
545 | xmlrpc_endpoint = urlappend(self.baseurl, 'xmlrpc') |
546 | - self._server = xmlrpc_client.ServerProxy( |
547 | + self._server = xmlrpc.client.ServerProxy( |
548 | xmlrpc_endpoint, transport=self._xmlrpc_transport) |
549 | |
550 | def makeRequest(self, method, url, **kwargs): |
551 | @@ -365,7 +365,7 @@ class TracLPPlugin(Trac): |
552 | @ensure_no_transaction |
553 | def _generateAuthenticationToken(self): |
554 | """Create an authentication token and return it.""" |
555 | - internal_xmlrpc = xmlrpc_client.ServerProxy( |
556 | + internal_xmlrpc = xmlrpc.client.ServerProxy( |
557 | config.checkwatches.xmlrpc_url, |
558 | transport=self._internal_xmlrpc_transport) |
559 | return internal_xmlrpc.newBugTrackerToken() |
560 | @@ -491,7 +491,7 @@ class TracLPPlugin(Trac): |
561 | try: |
562 | timestamp, lp_bug_id = self._server.launchpad.get_launchpad_bug( |
563 | remote_bug) |
564 | - except xmlrpc_client.Fault as fault: |
565 | + except xmlrpc.client.Fault as fault: |
566 | # Deal with "Ticket does not exist" faults. We re-raise |
567 | # anything else, since they're a sign of a bigger problem. |
568 | if fault.faultCode == FAULT_TICKET_NOT_FOUND: |
569 | @@ -522,7 +522,7 @@ class TracLPPlugin(Trac): |
570 | try: |
571 | self._server.launchpad.set_launchpad_bug( |
572 | remote_bug, launchpad_bug_id) |
573 | - except xmlrpc_client.Fault as fault: |
574 | + except xmlrpc.client.Fault as fault: |
575 | # Deal with "Ticket does not exist" faults. We re-raise |
576 | # anything else, since they're a sign of a bigger problem. |
577 | 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 | |
584 | |
585 | from io import BytesIO |
586 | +from xmlrpc.client import ( |
587 | + ProtocolError, |
588 | + Transport, |
589 | + ) |
590 | |
591 | from defusedxml.xmlrpc import monkey_patch |
592 | import requests |
593 | @@ -18,10 +22,6 @@ from six.moves.urllib.parse import ( |
594 | urlparse, |
595 | urlunparse, |
596 | ) |
597 | -from six.moves.xmlrpc_client import ( |
598 | - ProtocolError, |
599 | - Transport, |
600 | - ) |
601 | |
602 | from lp.bugs.externalbugtracker.base import repost_on_redirect_hook |
603 | 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 | import sys |
610 | import threading |
611 | import time |
612 | +from xmlrpc.client import ProtocolError |
613 | |
614 | import pytz |
615 | import six |
616 | -from six.moves.xmlrpc_client import ProtocolError |
617 | from twisted.internet import reactor |
618 | from twisted.internet.defer import DeferredList |
619 | 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 | from datetime import datetime |
626 | import threading |
627 | import unittest |
628 | +from xmlrpc.client import ProtocolError |
629 | |
630 | -from six.moves.xmlrpc_client import ProtocolError |
631 | import transaction |
632 | from zope.component import getUtility |
633 | |
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 | ] |
640 | |
641 | import socket |
642 | - |
643 | -from six.moves.xmlrpc_client import ProtocolError |
644 | +from xmlrpc.client import ProtocolError |
645 | |
646 | from lp.bugs.externalbugtracker import ( |
647 | 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 | authenticate it with remote bug trackers. Generating these tokens is |
654 | done using the internal XML-RPC service. |
655 | |
656 | - >>> from six.moves import xmlrpc_client |
657 | + >>> import xmlrpc.client |
658 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
659 | - >>> bugtracker_api = xmlrpc_client.ServerProxy( |
660 | + >>> bugtracker_api = xmlrpc.client.ServerProxy( |
661 | ... 'http://xmlrpc-private.launchpad.test:8087/bugs', |
662 | ... transport=XMLRPCTestTransport()) |
663 | |
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 | Only the parts of TestBugzillaAPIXMLRPCTransport that are different from |
670 | its ancestor will be tested here. |
671 | |
672 | - >>> from six.moves import xmlrpc_client |
673 | + >>> import xmlrpc.client |
674 | >>> from lp.bugs.tests.externalbugtracker import ( |
675 | ... TestBugzillaAPIXMLRPCTransport) |
676 | >>> bugzilla_transport = TestBugzillaAPIXMLRPCTransport( |
677 | ... 'http://example.com/xmlrpc.cgi') |
678 | - >>> server = xmlrpc_client.ServerProxy( |
679 | + >>> server = xmlrpc.client.ServerProxy( |
680 | ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport) |
681 | |
682 | |
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 | The TestBugzillaXMLRPCTransport is an XML-RPC transport which simulates |
689 | a remote Bugzilla instance that implements the Launchpad plugin API. |
690 | |
691 | - >>> from six.moves import xmlrpc_client |
692 | + >>> import xmlrpc.client |
693 | >>> from lp.bugs.tests.externalbugtracker import ( |
694 | ... TestBugzillaXMLRPCTransport) |
695 | >>> bugzilla_transport = TestBugzillaXMLRPCTransport( |
696 | ... 'http://example.com/xmlrpc.cgi') |
697 | - >>> server = xmlrpc_client.ServerProxy( |
698 | + >>> server = xmlrpc.client.ServerProxy( |
699 | ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport) |
700 | |
701 | 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 | server, 'foo=bar'. |
708 | |
709 | >>> import responses |
710 | - >>> from six.moves import xmlrpc_client |
711 | + >>> import xmlrpc.client |
712 | |
713 | >>> def test_callback(request): |
714 | - ... params = xmlrpc_client.loads(request.body)[0] |
715 | + ... params = xmlrpc.client.loads(request.body)[0] |
716 | ... return ( |
717 | ... 200, {'Set-Cookie': 'foo=bar'}, |
718 | - ... xmlrpc_client.dumps( |
719 | + ... xmlrpc.client.dumps( |
720 | ... ([request.url] + list(params),), methodresponse=True)) |
721 | |
722 | 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 | foo=bar |
725 | |
726 | If an error occurs trying to make the request, an |
727 | -``xmlrpc_client.ProtocolError`` is raised. |
728 | +``xmlrpc.client.ProtocolError`` is raised. |
729 | |
730 | >>> request_body = """<?xml version="1.0"?> |
731 | ... <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 | import random |
738 | import re |
739 | import time |
740 | +import xmlrpc.client |
741 | |
742 | import responses |
743 | import six |
744 | -from six.moves import xmlrpc_client |
745 | from six.moves.urllib_parse import ( |
746 | parse_qs, |
747 | urljoin, |
748 | @@ -564,7 +564,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): |
749 | method on this class with the same name as the XML-RPC method is |
750 | called, with the extracted arguments passed on to it. |
751 | """ |
752 | - args, method_name = xmlrpc_client.loads(request) |
753 | + args, method_name = xmlrpc.client.loads(request) |
754 | method_prefix, method_name = method_name.split('.') |
755 | |
756 | assert method_prefix in self.methods, ( |
757 | @@ -579,7 +579,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): |
758 | # cookie, throw a Fault. |
759 | if (method_name in self.auth_required_methods and |
760 | not self.has_valid_auth_cookie): |
761 | - raise xmlrpc_client.Fault(410, 'Login Required') |
762 | + raise xmlrpc.client.Fault(410, 'Login Required') |
763 | |
764 | if self.print_method_calls: |
765 | if len(args) > 0: |
766 | @@ -638,7 +638,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): |
767 | self._setAuthCookie() |
768 | |
769 | # We always return the same user ID. |
770 | - # This has to be listified because xmlrpc_client tries to expand |
771 | + # This has to be listified because xmlrpc.client tries to expand |
772 | # sequences of length 1. |
773 | return [{'user_id': 42}] |
774 | |
775 | @@ -762,7 +762,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): |
776 | |
777 | # If the bug doesn't exist, raise a fault. |
778 | if int(bug_id) not in self.bugs: |
779 | - raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id) |
780 | + raise xmlrpc.client.Fault(101, "Bug #%s does not exist." % bug_id) |
781 | |
782 | # If we don't have comments for the bug already, create an empty |
783 | # comment dict. |
784 | @@ -790,7 +790,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): |
785 | |
786 | self.comment_id_index = comment_id |
787 | |
788 | - # We have to return a list here because xmlrpc_client will try to |
789 | + # We have to return a list here because xmlrpc.client will try to |
790 | # expand sequences of length 1. Trying to do that on a dict will |
791 | # cause it to explode. |
792 | return [{'comment_id': comment_id}] |
793 | @@ -810,7 +810,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport): |
794 | old_launchpad_id = bug['internals'].get('launchpad_id', 0) |
795 | bug['internals']['launchpad_id'] = launchpad_id |
796 | |
797 | - # We need to return a list here because xmlrpc_client will try to |
798 | + # We need to return a list here because xmlrpc.client will try to |
799 | # expand sequences of length 1, which will fail horribly when |
800 | # the sequence is in fact a dict. |
801 | return [{'launchpad_id': old_launchpad_id}] |
802 | @@ -908,7 +908,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): |
803 | |
804 | def version(self): |
805 | """Return the version of Bugzilla being used.""" |
806 | - # This is to work around the old "xmlrpc_client tries to expand |
807 | + # This is to work around the old "xmlrpc.client tries to expand |
808 | # sequences of length 1" problem (see above). |
809 | return [{'version': '3.4.1+'}] |
810 | |
811 | @@ -924,7 +924,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): |
812 | self._setAuthCookie() |
813 | return [{'id': self.users.index(user)}] |
814 | else: |
815 | - raise xmlrpc_client.Fault( |
816 | + raise xmlrpc.client.Fault( |
817 | 300, |
818 | "The username or password you entered is not valid.") |
819 | |
820 | @@ -1043,7 +1043,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): |
821 | |
822 | # If the bug doesn't exist, raise a fault. |
823 | if int(bug_id) not in self.bugs: |
824 | - raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id) |
825 | + raise xmlrpc.client.Fault(101, "Bug #%s does not exist." % bug_id) |
826 | |
827 | # If we don't have comments for the bug already, create an empty |
828 | # comment dict. |
829 | @@ -1072,7 +1072,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): |
830 | |
831 | self.comment_id_index = comment_id |
832 | |
833 | - # We have to return a list here because xmlrpc_client will try to |
834 | + # We have to return a list here because xmlrpc.client will try to |
835 | # expand sequences of length 1. Trying to do that on a dict will |
836 | # cause it to explode. |
837 | return [{'id': comment_id}] |
838 | @@ -1091,7 +1091,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): |
839 | |
840 | # If the bug ID doesn't exist, raise a Fault. |
841 | if bug_id not in self.bugs: |
842 | - raise xmlrpc_client.Fault( |
843 | + raise xmlrpc.client.Fault( |
844 | 101, "Bug #%s does not exist." % bug_id) |
845 | |
846 | see_also_list = self.bugs[bug_id].get('see_also', []) |
847 | @@ -1122,7 +1122,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): |
848 | |
849 | if ('launchpad' not in url and |
850 | 'show_bug.cgi' not in url): |
851 | - raise xmlrpc_client.Fault( |
852 | + raise xmlrpc.client.Fault( |
853 | 112, "Bug URL %s is invalid." % url) |
854 | |
855 | if changes.get(bug_id) is None: |
856 | @@ -1140,7 +1140,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport): |
857 | # Replace the bug's existing see_also list. |
858 | self.bugs[bug_id]['see_also'] = see_also_list |
859 | |
860 | - # We have to return a list here because xmlrpc_client will try to |
861 | + # We have to return a list here because xmlrpc.client will try to |
862 | # expand sequences of length 1. Trying to do that on a dict will |
863 | # cause it to explode. |
864 | return [{'changes': changes}] |
865 | @@ -1267,7 +1267,7 @@ class TestInternalXMLRPCTransport: |
866 | self.quiet = quiet |
867 | |
868 | def request(self, host, handler, request, verbose=None): |
869 | - args, method_name = xmlrpc_client.loads(request) |
870 | + args, method_name = xmlrpc.client.loads(request) |
871 | method = getattr(self, method_name) |
872 | with lp_dbuser(): |
873 | return method(*args) |
874 | @@ -1327,14 +1327,14 @@ class TestTracXMLRPCTransport(RequestsTransport): |
875 | """ |
876 | assert handler.endswith('/xmlrpc'), ( |
877 | 'The Trac endpoint must end with /xmlrpc') |
878 | - args, method_name = xmlrpc_client.loads(request) |
879 | + args, method_name = xmlrpc.client.loads(request) |
880 | prefix = 'launchpad.' |
881 | assert method_name.startswith(prefix), ( |
882 | 'All methods should be in the launchpad namespace') |
883 | if (self.auth_cookie is None or |
884 | self.auth_cookie == self.expired_cookie): |
885 | # All the Trac XML-RPC methods need authentication. |
886 | - raise xmlrpc_client.ProtocolError( |
887 | + raise xmlrpc.client.ProtocolError( |
888 | method_name, errcode=403, errmsg="Forbidden", |
889 | headers=None) |
890 | |
891 | @@ -1522,7 +1522,7 @@ class TestTracXMLRPCTransport(RequestsTransport): |
892 | return 0. Otherwise return the mapped Launchpad bug ID. |
893 | """ |
894 | if bugid not in self.remote_bugs: |
895 | - raise xmlrpc_client.Fault( |
896 | + raise xmlrpc.client.Fault( |
897 | FAULT_TICKET_NOT_FOUND, 'Ticket does not exist') |
898 | |
899 | return [self.utc_time, self.launchpad_bugs.get(bugid, 0)] |
900 | @@ -1536,12 +1536,12 @@ class TestTracXMLRPCTransport(RequestsTransport): |
901 | Return the current UTC timestamp. |
902 | """ |
903 | if bugid not in self.remote_bugs: |
904 | - raise xmlrpc_client.Fault( |
905 | + raise xmlrpc.client.Fault( |
906 | FAULT_TICKET_NOT_FOUND, 'Ticket does not exist') |
907 | |
908 | self.launchpad_bugs[bugid] = launchpad_bug |
909 | |
910 | - # Return a list, since xmlrpc_client insists on trying to expand |
911 | + # Return a list, since xmlrpc.client insists on trying to expand |
912 | # results. |
913 | return [self.utc_time] |
914 | |
915 | @@ -1698,7 +1698,7 @@ class TestDebBugs(DebBugs): |
916 | def ensure_response_parser_is_expat(transport): |
917 | """Ensure the transport always selects the Expat-based response parser. |
918 | |
919 | - The response parser is chosen by xmlrpc_client at runtime from a number |
920 | + The response parser is chosen by xmlrpc.client at runtime from a number |
921 | of choices, but the main Launchpad production environment selects Expat |
922 | at present. |
923 | |
924 | @@ -1707,8 +1707,8 @@ def ensure_response_parser_is_expat(transport): |
925 | response parsers to be chosen. |
926 | """ |
927 | def getparser(): |
928 | - target = xmlrpc_client.Unmarshaller( |
929 | + target = xmlrpc.client.Unmarshaller( |
930 | use_datetime=transport._use_datetime) |
931 | - parser = xmlrpc_client.ExpatParser(target) |
932 | + parser = xmlrpc.client.ExpatParser(target) |
933 | return parser, target |
934 | 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 | it implements the same API that Trac instances having the LP plugin |
941 | installed implement. |
942 | |
943 | - >>> from six.moves import xmlrpc_client |
944 | + >>> import xmlrpc.client |
945 | >>> from lp.bugs.tests.externalbugtracker import ( |
946 | ... TestTracXMLRPCTransport) |
947 | >>> trac_transport = TestTracXMLRPCTransport('http://example.com/xmlrpc') |
948 | - >>> server = xmlrpc_client.ServerProxy( |
949 | + >>> server = xmlrpc.client.ServerProxy( |
950 | ... 'http://example.com/xmlrpc', transport=trac_transport) |
951 | |
952 | 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 | if builder_status == "BuilderStatus.ABORTING": |
959 | logtail = u"Waiting for slave process to be terminated" |
960 | elif slave_status.get("logtail") is not None: |
961 | - # slave_status["logtail"] is an xmlrpc_client.Binary instance, |
962 | + # slave_status["logtail"] is an xmlrpc.client.Binary instance, |
963 | # and the contents might include invalid UTF-8 due to being a |
964 | # fixed number of bytes from the tail of the log. Turn it into |
965 | # 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 | from collections import OrderedDict |
972 | import os |
973 | import sys |
974 | +import xmlrpc.client |
975 | |
976 | import fixtures |
977 | from lpbuildd.tests.harness import BuilddSlaveTestSetup |
978 | import six |
979 | -from six.moves import xmlrpc_client |
980 | from testtools.content import attach_file |
981 | from twisted.internet import defer |
982 | from twisted.web import xmlrpc |
983 | @@ -160,7 +160,7 @@ class BuildingSlave(OkSlave): |
984 | |
985 | def status(self): |
986 | self.call_log.append('status') |
987 | - buildlog = xmlrpc_client.Binary( |
988 | + buildlog = xmlrpc.client.Binary( |
989 | b"This is a build log: %d" % self.status_count) |
990 | self.status_count += 1 |
991 | return defer.succeed({ |
992 | @@ -238,7 +238,7 @@ class AbortingSlave(OkSlave): |
993 | class LostBuildingBrokenSlave: |
994 | """A mock slave building bogus Build/BuildQueue IDs that can't be aborted. |
995 | |
996 | - When 'aborted' it raises an xmlrpc_client.Fault(8002, 'Could not abort') |
997 | + When 'aborted' it raises an xmlrpc.client.Fault(8002, 'Could not abort') |
998 | """ |
999 | |
1000 | def __init__(self): |
1001 | @@ -253,7 +253,7 @@ class LostBuildingBrokenSlave: |
1002 | |
1003 | def abort(self): |
1004 | self.call_log.append('abort') |
1005 | - return defer.fail(xmlrpc_client.Fault(8002, "Could not abort")) |
1006 | + return defer.fail(xmlrpc.client.Fault(8002, "Could not abort")) |
1007 | |
1008 | def resume(self): |
1009 | self.call_log.append('resume') |
1010 | @@ -268,7 +268,7 @@ class BrokenSlave: |
1011 | |
1012 | def status(self): |
1013 | self.call_log.append('status') |
1014 | - return defer.fail(xmlrpc_client.Fault(8001, "Broken slave")) |
1015 | + return defer.fail(xmlrpc.client.Fault(8001, "Broken slave")) |
1016 | |
1017 | |
1018 | 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 | import os |
1025 | import signal |
1026 | import tempfile |
1027 | +import xmlrpc.client |
1028 | |
1029 | from lpbuildd.builder import BuilderStatus |
1030 | import six |
1031 | -from six.moves import xmlrpc_client |
1032 | from testtools.matchers import ContainsAll |
1033 | from testtools.testcase import ExpectedException |
1034 | from testtools.twistedsupport import ( |
1035 | @@ -291,7 +291,7 @@ class TestBuilderInteractorCleanSlave(TestCase): |
1036 | try: |
1037 | yield BuilderInteractor.cleanSlave( |
1038 | vitals, slave, MockBuilderFactory(builder, None)) |
1039 | - except xmlrpc_client.Fault: |
1040 | + except xmlrpc.client.Fault: |
1041 | self.assertEqual(['status', 'abort'], slave.call_log) |
1042 | else: |
1043 | self.fail("abort() should crash.") |
1044 | @@ -325,7 +325,7 @@ class TestBuilderSlaveStatus(TestCase): |
1045 | del status["build_id"] |
1046 | if logtail: |
1047 | tail = status.pop("logtail") |
1048 | - self.assertIsInstance(tail, xmlrpc_client.Binary) |
1049 | + self.assertIsInstance(tail, xmlrpc.client.Binary) |
1050 | |
1051 | self.assertEqual(expected, status) |
1052 | |
1053 | @@ -584,7 +584,7 @@ class TestSlave(TestCase): |
1054 | status = yield slave.status() |
1055 | self.assertEqual(BuilderStatus.BUILDING, status['builder_status']) |
1056 | self.assertEqual(build_id, status['build_id']) |
1057 | - self.assertIsInstance(status['logtail'], xmlrpc_client.Binary) |
1058 | + self.assertIsInstance(status['logtail'], xmlrpc.client.Binary) |
1059 | |
1060 | @defer.inlineCallbacks |
1061 | 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 | import signal |
1068 | import time |
1069 | from unittest import mock |
1070 | +import xmlrpc.client |
1071 | |
1072 | import six |
1073 | -from six.moves import xmlrpc_client |
1074 | from testtools.matchers import Equals |
1075 | from testtools.testcase import ExpectedException |
1076 | from testtools.twistedsupport import AsynchronousDeferredRunTest |
1077 | @@ -308,7 +308,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): |
1078 | builder.failure_count = 0 |
1079 | transaction.commit() |
1080 | scanner = self._getScanner(builder_name=builder.name) |
1081 | - with ExpectedException(xmlrpc_client.Fault): |
1082 | + with ExpectedException(xmlrpc.client.Fault): |
1083 | yield scanner.scan() |
1084 | |
1085 | @defer.inlineCallbacks |
1086 | @@ -319,7 +319,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): |
1087 | @defer.inlineCallbacks |
1088 | def status(self): |
1089 | status = yield super(BrokenUTF8Slave, self).status() |
1090 | - status["logtail"] = xmlrpc_client.Binary( |
1091 | + status["logtail"] = xmlrpc.client.Binary( |
1092 | u"───".encode("UTF-8")[1:]) |
1093 | return status |
1094 | |
1095 | @@ -349,7 +349,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): |
1096 | @defer.inlineCallbacks |
1097 | def status(self): |
1098 | status = yield super(NULSlave, self).status() |
1099 | - status["logtail"] = xmlrpc_client.Binary(b"foo\0bar\0baz") |
1100 | + status["logtail"] = xmlrpc.client.Binary(b"foo\0bar\0baz") |
1101 | return status |
1102 | |
1103 | builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME] |
1104 | @@ -1196,7 +1196,7 @@ class TestCancellationChecking(TestCaseWithFactory): |
1105 | slave = LostBuildingBrokenSlave() |
1106 | self.builder.current_build.cancel() |
1107 | with ExpectedException( |
1108 | - xmlrpc_client.Fault, "<Fault 8002: %r>" % 'Could not abort'): |
1109 | + xmlrpc.client.Fault, "<Fault 8002: %r>" % 'Could not abort'): |
1110 | yield self._getScanner().checkCancellation(self.vitals, slave) |
1111 | |
1112 | |
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 | IPublicCodehostingAPI |
1119 | ===================== |
1120 | |
1121 | - >>> from six.moves import xmlrpc_client |
1122 | + >>> import xmlrpc.client |
1123 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
1124 | |
1125 | |
1126 | @@ -17,7 +17,7 @@ Bazaar is strictly unsupported. |
1127 | This API is deprecated, and will eventually be replaced with an |
1128 | equivalent method in the new Launchpad API infrastructure. |
1129 | |
1130 | - >>> public_codehosting_api = xmlrpc_client.ServerProxy( |
1131 | + >>> public_codehosting_api = xmlrpc.client.ServerProxy( |
1132 | ... 'http://xmlrpc.launchpad.test/bazaar/', |
1133 | ... transport=XMLRPCTestTransport()) |
1134 | |
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 | |
1141 | The point of all this is for it to be accessed over XMLRPC. |
1142 | |
1143 | - >>> from six.moves import xmlrpc_client |
1144 | + >>> import xmlrpc.client |
1145 | >>> from lp.testing.xmlrpc import XMLRPCTestTransport |
1146 | - >>> codeimportscheduler = xmlrpc_client.ServerProxy( |
1147 | + >>> codeimportscheduler = xmlrpc.client.ServerProxy( |
1148 | ... 'http://xmlrpc-private.launchpad.test:8087/codeimportscheduler', |
1149 | ... transport=XMLRPCTestTransport()) |
1150 | >>> 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 | :param job_id: The ID of the code import job to finish. |
1157 | :param status_name: The outcome of the job as the name of a |
1158 | `CodeImportResultStatus` item. |
1159 | - :param log_file: A log file to display for diagnostics, either as a |
1160 | - `six.moves.xmlrpc_client.Binary` containing the log file data or |
1161 | + :param log_file: A log file to display for diagnostics, either as an |
1162 | + `xmlrpc.client.Binary` containing the log file data or |
1163 | as the URL of a file in the librarian. |
1164 | :raise NoSuchCodeImportJob: if no job with id `job_id` exists. |
1165 | """ |
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 | 'PublicCodehostingAPI', |
1172 | ] |
1173 | |
1174 | +from xmlrpc.client import Fault |
1175 | |
1176 | from breezy import urlutils |
1177 | -from six.moves.xmlrpc_client import Fault |
1178 | from zope.component import getUtility |
1179 | from zope.interface import ( |
1180 | 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 | ] |
1187 | |
1188 | import io |
1189 | +import xmlrpc.client |
1190 | |
1191 | import six |
1192 | -from six.moves import xmlrpc_client |
1193 | from zope.component import getUtility |
1194 | from zope.interface import implementer |
1195 | from zope.security.proxy import removeSecurityProxy |
1196 | @@ -92,7 +92,7 @@ class CodeImportSchedulerAPI(LaunchpadXMLRPCView): |
1197 | job = self._getJob(job_id) |
1198 | status = CodeImportResultStatus.items[status_name] |
1199 | workflow = removeSecurityProxy(getUtility(ICodeImportJobWorkflow)) |
1200 | - if isinstance(log_file, xmlrpc_client.Binary): |
1201 | + if isinstance(log_file, xmlrpc.client.Binary): |
1202 | if log_file.data: |
1203 | log_file_name = '%s.log' % ( |
1204 | 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 | import logging |
1211 | import sys |
1212 | import uuid |
1213 | +import xmlrpc.client |
1214 | |
1215 | from pymacaroons import Macaroon |
1216 | import six |
1217 | -from six.moves import xmlrpc_client |
1218 | from six.moves.urllib.parse import quote |
1219 | import transaction |
1220 | from zope.component import ( |
1221 | @@ -454,7 +454,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1222 | requester_id, self._translatePath, |
1223 | six.ensure_text(path).strip("/"), permission, auth_params) |
1224 | try: |
1225 | - if isinstance(result, xmlrpc_client.Fault): |
1226 | + if isinstance(result, xmlrpc.client.Fault): |
1227 | logger.error("translatePath failed: %r", result) |
1228 | else: |
1229 | # The results of path translation are not sensitive for |
1230 | @@ -502,7 +502,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1231 | requester_id, self._notify, |
1232 | translated_path, statistics, auth_params) |
1233 | try: |
1234 | - if isinstance(result, xmlrpc_client.Fault): |
1235 | + if isinstance(result, xmlrpc.client.Fault): |
1236 | logger.error("notify failed: %r", result) |
1237 | else: |
1238 | logger.info("notify succeeded: %s" % result) |
1239 | @@ -544,7 +544,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1240 | requester_id, self._getMergeProposalURL, |
1241 | translated_path, branch, auth_params) |
1242 | try: |
1243 | - if isinstance(result, xmlrpc_client.Fault): |
1244 | + if isinstance(result, xmlrpc.client.Fault): |
1245 | logger.error("getMergeProposalURL failed: %r", result) |
1246 | else: |
1247 | # The result of getMergeProposalURL is not sensitive for |
1248 | @@ -586,7 +586,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1249 | "Request received: authenticateWithPassword('%s')", username) |
1250 | result = self._authenticateWithPassword(username, password) |
1251 | try: |
1252 | - if isinstance(result, xmlrpc_client.Fault): |
1253 | + if isinstance(result, xmlrpc.client.Fault): |
1254 | logger.error("authenticateWithPassword failed: %r", result) |
1255 | else: |
1256 | # The results of authentication may be sensitive, but we can |
1257 | @@ -640,7 +640,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1258 | # the moment. It's possible to reach this by being very unlucky |
1259 | # about the timing of a push. |
1260 | return [ |
1261 | - (xmlrpc_client.Binary(ref_path.data), []) |
1262 | + (xmlrpc.client.Binary(ref_path.data), []) |
1263 | for ref_path in ref_paths] |
1264 | |
1265 | # Caller sends paths as bytes; Launchpad returns a list of (path, |
1266 | @@ -648,7 +648,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1267 | # bytes.) |
1268 | ref_paths = [ref_path.data for ref_path in ref_paths] |
1269 | return [ |
1270 | - (xmlrpc_client.Binary(ref_path), |
1271 | + (xmlrpc.client.Binary(ref_path), |
1272 | self._renderPermissions(permissions)) |
1273 | for ref_path, permissions in repository.checkRefPermissions( |
1274 | requester, ref_paths).items() |
1275 | @@ -666,7 +666,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1276 | requester_id, self._checkRefPermissions, |
1277 | translated_path, ref_paths, auth_params) |
1278 | try: |
1279 | - if isinstance(result, xmlrpc_client.Fault): |
1280 | + if isinstance(result, xmlrpc.client.Fault): |
1281 | logger.error("checkRefPermissions failed: %r", result) |
1282 | else: |
1283 | # The results of ref permission checks are not sensitive for |
1284 | @@ -736,7 +736,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1285 | except Exception as e: |
1286 | result = e |
1287 | try: |
1288 | - if isinstance(result, xmlrpc_client.Fault): |
1289 | + if isinstance(result, xmlrpc.client.Fault): |
1290 | logger.error("confirmRepoCreation failed: %r", result) |
1291 | else: |
1292 | logger.info("confirmRepoCreation succeeded: %s" % result) |
1293 | @@ -767,7 +767,7 @@ class GitAPI(LaunchpadXMLRPCView): |
1294 | except Exception as e: |
1295 | result = e |
1296 | try: |
1297 | - if isinstance(result, xmlrpc_client.Fault): |
1298 | + if isinstance(result, xmlrpc.client.Fault): |
1299 | logger.error("abortRepoCreation failed: %r", result) |
1300 | else: |
1301 | 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 | """Unit tests for the public codehosting API.""" |
1308 | |
1309 | import os |
1310 | +import xmlrpc.client |
1311 | |
1312 | from breezy import urlutils |
1313 | from lazr.uri import URI |
1314 | -from six.moves import xmlrpc_client |
1315 | from zope.security.proxy import removeSecurityProxy |
1316 | |
1317 | from lp.app.enums import InformationType |
1318 | @@ -79,7 +79,7 @@ class TestExpandURL(TestCaseWithFactory): |
1319 | api = PublicCodehostingAPI(None, None) |
1320 | fault = api.resolve_lp_path(lp_url_path) |
1321 | self.assertTrue( |
1322 | - isinstance(fault, xmlrpc_client.Fault), |
1323 | + isinstance(fault, xmlrpc.client.Fault), |
1324 | "resolve_lp_path(%r) returned %r, not a Fault." |
1325 | % (lp_url_path, fault)) |
1326 | 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 | |
1333 | """Test for the methods of `ICodeImportScheduler`.""" |
1334 | |
1335 | -from six.moves import xmlrpc_client |
1336 | +import xmlrpc.client |
1337 | + |
1338 | import transaction |
1339 | from zope.component import getUtility |
1340 | from zope.security.proxy import removeSecurityProxy |
1341 | @@ -76,7 +77,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): |
1342 | # is no code import job with the given ID. |
1343 | fault = self.api.getImportDataForJobID(-1) |
1344 | self.assertTrue( |
1345 | - isinstance(fault, xmlrpc_client.Fault), |
1346 | + isinstance(fault, xmlrpc.client.Fault), |
1347 | "getImportDataForJobID(-1) returned %r, not a Fault." |
1348 | % (fault,)) |
1349 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) |
1350 | @@ -95,7 +96,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): |
1351 | # code import job with the given ID. |
1352 | fault = self.api.updateHeartbeat(-1, '') |
1353 | self.assertTrue( |
1354 | - isinstance(fault, xmlrpc_client.Fault), |
1355 | + isinstance(fault, xmlrpc.client.Fault), |
1356 | "updateHeartbeat(-1, '') returned %r, not a Fault." |
1357 | % (fault,)) |
1358 | self.assertEqual(NoSuchCodeImportJob, fault.__class__) |
1359 | @@ -131,7 +132,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): |
1360 | code_import = code_import_job.code_import |
1361 | self.api.finishJobID( |
1362 | code_import_job.id, CodeImportResultStatus.SUCCESS.name, |
1363 | - xmlrpc_client.Binary(b'log file data\n')) |
1364 | + xmlrpc.client.Binary(b'log file data\n')) |
1365 | transaction.commit() |
1366 | self.assertEqual( |
1367 | b'log file data\n', code_import.results.last().log_file.read()) |
1368 | @@ -143,7 +144,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): |
1369 | code_import = code_import_job.code_import |
1370 | self.api.finishJobID( |
1371 | code_import_job.id, CodeImportResultStatus.SUCCESS.name, |
1372 | - xmlrpc_client.Binary(b'')) |
1373 | + xmlrpc.client.Binary(b'')) |
1374 | self.assertIsNone(code_import.results.last().log_file) |
1375 | |
1376 | def test_finishJobID_not_found(self): |
1377 | @@ -152,7 +153,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory): |
1378 | fault = self.api.finishJobID( |
1379 | -1, CodeImportResultStatus.SUCCESS.name, '') |
1380 | self.assertTrue( |
1381 | - isinstance(fault, xmlrpc_client.Fault), |
1382 | + isinstance(fault, xmlrpc.client.Fault), |
1383 | "finishJobID(-1, 'SUCCESS', 0) returned %r, not a Fault." |
1384 | % (fault,)) |
1385 | 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 | from datetime import datetime |
1392 | import hashlib |
1393 | import uuid |
1394 | +import xmlrpc.client |
1395 | |
1396 | from fixtures import FakeLogger |
1397 | from pymacaroons import Macaroon |
1398 | import pytz |
1399 | import six |
1400 | -from six.moves import xmlrpc_client |
1401 | from six.moves.urllib.parse import quote |
1402 | from storm.store import Store |
1403 | from testtools.matchers import ( |
1404 | @@ -157,7 +157,7 @@ class TestGitAPIMixin: |
1405 | |
1406 | def setUp(self): |
1407 | super(TestGitAPIMixin, self).setUp() |
1408 | - self.git_api = xmlrpc_client.ServerProxy( |
1409 | + self.git_api = xmlrpc.client.ServerProxy( |
1410 | "http://xmlrpc-private.launchpad.test:8087/git", |
1411 | transport=XMLRPCTestTransport()) |
1412 | self.hosting_fixture = self.useFixture(GitHostingFixture()) |
1413 | @@ -169,7 +169,7 @@ class TestGitAPIMixin: |
1414 | """Assert that a call raises the expected fault.""" |
1415 | with FakeLogger() as logger: |
1416 | fault = self.assertRaises( |
1417 | - xmlrpc_client.Fault, getattr(self.git_api, func_name), |
1418 | + xmlrpc.client.Fault, getattr(self.git_api, func_name), |
1419 | *args, **kwargs) |
1420 | self.assertThat(fault, MatchesFault(expected_fault)) |
1421 | self.assertThat(logger.output, MatchesRegex( |
1422 | @@ -468,14 +468,14 @@ class TestGitAPIMixin: |
1423 | request_id = auth_params["request-id"] |
1424 | translated_path = removeSecurityProxy(repository).getInternalPath() |
1425 | ref_paths = [ |
1426 | - xmlrpc_client.Binary(ref_path) for ref_path in ref_paths] |
1427 | + xmlrpc.client.Binary(ref_path) for ref_path in ref_paths] |
1428 | results = self.assertDoesNotFault( |
1429 | request_id, "checkRefPermissions", |
1430 | translated_path, ref_paths, auth_params) |
1431 | self.assertThat(results, MatchesSetwise(*( |
1432 | MatchesListwise([ |
1433 | MatchesAll( |
1434 | - IsInstance(xmlrpc_client.Binary), |
1435 | + IsInstance(xmlrpc.client.Binary), |
1436 | MatchesStructure.byEquality(data=ref_path)), |
1437 | Equals(ref_permissions), |
1438 | ]) |
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 | ] |
1445 | |
1446 | import operator |
1447 | +from xmlrpc.client import Fault |
1448 | |
1449 | from breezy.urlutils import ( |
1450 | escape, |
1451 | unescape, |
1452 | ) |
1453 | import six |
1454 | -from six.moves.xmlrpc_client import Fault |
1455 | from twisted.internet import defer |
1456 | from zope.component import ( |
1457 | 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 | |
1464 | import os |
1465 | import re |
1466 | +import xmlrpc.client |
1467 | |
1468 | import breezy.branch |
1469 | from breezy.tests import TestCaseWithTransport |
1470 | @@ -12,7 +13,6 @@ from breezy.tests.per_repository import all_repository_format_scenarios |
1471 | from breezy.urlutils import local_path_from_url |
1472 | from breezy.workingtree import WorkingTree |
1473 | import six |
1474 | -from six.moves import xmlrpc_client |
1475 | from six.moves.urllib.request import urlopen |
1476 | from testscenarios import ( |
1477 | load_tests_apply_scenarios, |
1478 | @@ -229,9 +229,9 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory): |
1479 | Used to create branches that the test user is not able to create, and |
1480 | might not even be able to view. |
1481 | """ |
1482 | - authserver = xmlrpc_client.ServerProxy( |
1483 | + authserver = xmlrpc.client.ServerProxy( |
1484 | config.codehosting.authentication_endpoint) |
1485 | - codehosting_api = xmlrpc_client.ServerProxy( |
1486 | + codehosting_api = xmlrpc.client.ServerProxy( |
1487 | config.codehosting.codehosting_endpoint) |
1488 | if creator is None: |
1489 | 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 | |
1496 | import os.path |
1497 | import sys |
1498 | +import xmlrpc.client |
1499 | |
1500 | from breezy import urlutils |
1501 | from breezy.bzr.bzrdir import BzrDir |
1502 | @@ -69,7 +70,6 @@ from breezy.transport import get_transport |
1503 | from breezy.transport.memory import MemoryServer |
1504 | from lazr.uri import URI |
1505 | import six |
1506 | -from six.moves import xmlrpc_client |
1507 | from twisted.internet import ( |
1508 | defer, |
1509 | error, |
1510 | @@ -170,7 +170,7 @@ def is_lock_directory(absolute_path): |
1511 | |
1512 | def get_ro_server(): |
1513 | """Get a Launchpad internal server for scanning branches.""" |
1514 | - proxy = xmlrpc_client.ServerProxy(config.codehosting.codehosting_endpoint) |
1515 | + proxy = xmlrpc.client.ServerProxy(config.codehosting.codehosting_endpoint) |
1516 | codehosting_endpoint = DeferredBlockingProxy(proxy) |
1517 | branch_transport = get_readonly_transport( |
1518 | get_transport(config.codehosting.internal_branch_by_id_root)) |
1519 | @@ -193,7 +193,7 @@ def get_rw_server(direct_database=False): |
1520 | if direct_database: |
1521 | return DirectDatabaseLaunchpadServer('lp-internal:///', transport) |
1522 | else: |
1523 | - proxy = xmlrpc_client.ServerProxy( |
1524 | + proxy = xmlrpc.client.ServerProxy( |
1525 | config.codehosting.codehosting_endpoint) |
1526 | codehosting_endpoint = DeferredBlockingProxy(proxy) |
1527 | return LaunchpadInternalServer( |
1528 | @@ -749,7 +749,7 @@ def get_lp_server(user_id, codehosting_endpoint_url=None, branch_url=None, |
1529 | raise AssertionError( |
1530 | "can't supply both branch_url and branch_transport!") |
1531 | |
1532 | - codehosting_client = xmlrpc_client.ServerProxy(codehosting_endpoint_url) |
1533 | + codehosting_client = xmlrpc.client.ServerProxy(codehosting_endpoint_url) |
1534 | lp_server = LaunchpadServer( |
1535 | DeferredBlockingProxy(codehosting_client), user_id, branch_transport, |
1536 | 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 | import os |
1543 | import re |
1544 | import sys |
1545 | +import xmlrpc.client |
1546 | |
1547 | from breezy import errors |
1548 | from breezy.bzr.bzrdir import BzrDir |
1549 | @@ -33,7 +34,6 @@ from breezy.urlutils import ( |
1550 | ) |
1551 | from fixtures import MonkeyPatch |
1552 | import six |
1553 | -from six.moves import xmlrpc_client |
1554 | from testtools.twistedsupport import ( |
1555 | assert_fails_with, |
1556 | AsynchronousDeferredRunTest, |
1557 | @@ -1035,7 +1035,7 @@ class TestBranchChangedErrorHandling(TestCaseWithTransport, TestCase): |
1558 | report = errorlog.globalErrorUtility.raising(f, request) |
1559 | # Record the id for checking later. |
1560 | self.generated_oopsids.append(report['id']) |
1561 | - raise xmlrpc_client.Fault(-1, report) |
1562 | + raise xmlrpc.client.Fault(-1, report) |
1563 | |
1564 | def get_server(self): |
1565 | 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 | 'new_team', |
1572 | ] |
1573 | |
1574 | -from six.moves import xmlrpc_client |
1575 | +import xmlrpc.client |
1576 | + |
1577 | from zope.component import getUtility |
1578 | |
1579 | from lp.registry.enums import TeamMembershipPolicy |
1580 | @@ -36,7 +37,7 @@ def fault_catcher(func): |
1581 | |
1582 | def caller(self, *args, **kws): |
1583 | result = func(self, *args, **kws) |
1584 | - if isinstance(result, xmlrpc_client.Fault): |
1585 | + if isinstance(result, xmlrpc.client.Fault): |
1586 | raise result |
1587 | else: |
1588 | 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 | |
1595 | import email |
1596 | from textwrap import dedent |
1597 | +import xmlrpc.client |
1598 | |
1599 | -from six.moves import xmlrpc_client |
1600 | from testtools.matchers import ( |
1601 | Equals, |
1602 | MatchesDict, |
1603 | @@ -498,7 +498,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory): |
1604 | I put \xa9 in the body. |
1605 | """).encode('ISO-8859-1')) |
1606 | info = self.mailinglist_api.holdMessage( |
1607 | - 'team', xmlrpc_client.Binary(message_as_bytes(message))) |
1608 | + 'team', xmlrpc.client.Binary(message_as_bytes(message))) |
1609 | transaction.commit() |
1610 | found = self.message_approval_set.getMessageByMessageID('<\\xa9-me>') |
1611 | 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 | |
1618 | from email import message_from_string |
1619 | from textwrap import dedent |
1620 | +import xmlrpc.client |
1621 | |
1622 | -from six.moves import xmlrpc_client |
1623 | from zope.component import getUtility |
1624 | from zope.security.proxy import removeSecurityProxy |
1625 | |
1626 | @@ -42,7 +42,7 @@ class TestCanonicalSSOApplication(TestCaseWithFactory): |
1627 | |
1628 | def setUp(self): |
1629 | super(TestCanonicalSSOApplication, self).setUp() |
1630 | - self.rpc_proxy = xmlrpc_client.ServerProxy( |
1631 | + self.rpc_proxy = xmlrpc.client.ServerProxy( |
1632 | 'http://xmlrpc-private.launchpad.test:8087/canonicalsso', |
1633 | transport=XMLRPCTestTransport()) |
1634 | |
1635 | @@ -71,12 +71,12 @@ class TestCanonicalSSOApplication(TestCaseWithFactory): |
1636 | person = self.factory.makePerson() |
1637 | openid_identifier = removeSecurityProxy( |
1638 | person.account).openid_identifiers.any().identifier |
1639 | - public_rpc_proxy = xmlrpc_client.ServerProxy( |
1640 | + public_rpc_proxy = xmlrpc.client.ServerProxy( |
1641 | 'http://test@canonical.com:test@' |
1642 | 'xmlrpc.launchpad.test/canonicalsso', |
1643 | transport=XMLRPCTestTransport()) |
1644 | e = self.assertRaises( |
1645 | - xmlrpc_client.ProtocolError, |
1646 | + xmlrpc.client.ProtocolError, |
1647 | public_rpc_proxy.getPersonDetailsByOpenIDIdentifier, |
1648 | openid_identifier) |
1649 | self.assertEqual(404, e.errcode) |
1650 | @@ -88,7 +88,7 @@ class TestMailingListXMLRPC(TestCaseWithFactory): |
1651 | |
1652 | def setUp(self): |
1653 | super(TestMailingListXMLRPC, self).setUp() |
1654 | - self.rpc_proxy = xmlrpc_client.ServerProxy( |
1655 | + self.rpc_proxy = xmlrpc.client.ServerProxy( |
1656 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', |
1657 | transport=XMLRPCTestTransport()) |
1658 | |
1659 | @@ -147,7 +147,7 @@ class TestMailingListXMLRPCMessage(TestCaseWithFactory): |
1660 | |
1661 | def setUp(self): |
1662 | super(TestMailingListXMLRPCMessage, self).setUp() |
1663 | - self.rpc_proxy = xmlrpc_client.ServerProxy( |
1664 | + self.rpc_proxy = xmlrpc.client.ServerProxy( |
1665 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', |
1666 | transport=XMLRPCTestTransport()) |
1667 | |
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 | ] |
1674 | |
1675 | import re |
1676 | +import xmlrpc.client |
1677 | |
1678 | from six import ensure_text |
1679 | -from six.moves import xmlrpc_client |
1680 | from zope.component import getUtility |
1681 | from zope.interface import implementer |
1682 | from zope.security.proxy import removeSecurityProxy |
1683 | @@ -244,7 +244,7 @@ class MailingListAPIView(LaunchpadXMLRPCView): |
1684 | # non-ascii characters in the message can be safely passed across |
1685 | # XMLRPC. For most tests though it's much more convenient to just |
1686 | # pass 8-bit strings. |
1687 | - if isinstance(bytes, xmlrpc_client.Binary): |
1688 | + if isinstance(bytes, xmlrpc.client.Binary): |
1689 | bytes = bytes.data |
1690 | team_name = ensure_text(team_name) |
1691 | # 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 | |
1698 | """Tests for the internal codehosting API.""" |
1699 | |
1700 | +import xmlrpc.client |
1701 | + |
1702 | from pymacaroons import Macaroon |
1703 | -from six.moves import xmlrpc_client |
1704 | from storm.sqlobject import SQLObjectNotFound |
1705 | from testtools.matchers import ( |
1706 | Equals, |
1707 | @@ -122,7 +123,7 @@ class GetUserAndSSHKeysTests(TestCaseWithFactory): |
1708 | new_person = self.factory.makePerson() |
1709 | with person_logged_in(new_person): |
1710 | key = self.factory.makeSSHKey(person=new_person) |
1711 | - authserver = xmlrpc_client.ServerProxy( |
1712 | + authserver = xmlrpc.client.ServerProxy( |
1713 | 'http://xmlrpc-private.launchpad.test:8087/authserver', |
1714 | transport=XMLRPCTestTransport()) |
1715 | 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 | Feature flags can also be checked without access to the database by making use |
1722 | of the 'getFeatureFlag' XML-RPC method. |
1723 | |
1724 | - server_proxy = xmlrpc_client.ServerProxy( |
1725 | + server_proxy = xmlrpc.client.ServerProxy( |
1726 | config.launchpad.feature_flags_endpoint, allow_none=True) |
1727 | if server_proxy.getFeatureFlag( |
1728 | '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 | |
1735 | """Tests for FeatureFlagApplication.""" |
1736 | |
1737 | -from six.moves import xmlrpc_client |
1738 | +import xmlrpc.client |
1739 | |
1740 | from lp.services import features |
1741 | from lp.services.config import config |
1742 | @@ -82,13 +82,13 @@ class TestGetFeatureFlag(TestCaseWithFactory): |
1743 | flag_name, ['user:' + person.name])) |
1744 | |
1745 | def test_xmlrpc_interface_unset(self): |
1746 | - sp = xmlrpc_client.ServerProxy( |
1747 | + sp = xmlrpc.client.ServerProxy( |
1748 | config.launchpad.feature_flags_endpoint, |
1749 | transport=XMLRPCTestTransport(), allow_none=True) |
1750 | self.assertEqual(None, sp.getFeatureFlag(u'flag')) |
1751 | |
1752 | def test_xmlrpc_interface_set(self): |
1753 | - sp = xmlrpc_client.ServerProxy( |
1754 | + sp = xmlrpc.client.ServerProxy( |
1755 | config.launchpad.feature_flags_endpoint, |
1756 | transport=XMLRPCTestTransport(), allow_none=True) |
1757 | 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 | ] |
1764 | |
1765 | import hashlib |
1766 | +from xmlrpc.client import Fault |
1767 | |
1768 | from pymacaroons import Macaroon |
1769 | from six.moves.urllib.parse import ( |
1770 | quote, |
1771 | unquote, |
1772 | ) |
1773 | -from six.moves.xmlrpc_client import Fault |
1774 | from storm.expr import ( |
1775 | And, |
1776 | 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 | import socket |
1783 | from textwrap import dedent |
1784 | import threading |
1785 | +import xmlrpc.client |
1786 | |
1787 | from fixtures import ( |
1788 | MonkeyPatch, |
1789 | @@ -17,10 +18,7 @@ from requests.exceptions import ( |
1790 | ConnectionError, |
1791 | InvalidSchema, |
1792 | ) |
1793 | -from six.moves import ( |
1794 | - xmlrpc_client, |
1795 | - xmlrpc_server, |
1796 | - ) |
1797 | +from six.moves import xmlrpc_server |
1798 | from testtools.matchers import ( |
1799 | ContainsDict, |
1800 | Equals, |
1801 | @@ -505,7 +503,7 @@ class TestTimeout(TestCase): |
1802 | logRequests=False) |
1803 | server_thread = threading.Thread(target=server.serve_2_requests) |
1804 | server_thread.start() |
1805 | - proxy = xmlrpc_client.ServerProxy( |
1806 | + proxy = xmlrpc.client.ServerProxy( |
1807 | http_server_url, transport=TransportWithTimeout()) |
1808 | self.assertEqual('Successful test message.', |
1809 | 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 | Lock, |
1816 | Thread, |
1817 | ) |
1818 | +from xmlrpc.client import Transport |
1819 | |
1820 | from requests import ( |
1821 | HTTPError, |
1822 | @@ -37,7 +38,6 @@ from requests_file import FileAdapter |
1823 | from requests_toolbelt.downloadutils import stream |
1824 | import six |
1825 | from six import reraise |
1826 | -from six.moves.xmlrpc_client import Transport |
1827 | from urllib3.connectionpool import ( |
1828 | HTTPConnectionPool, |
1829 | 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 | def __init__(self, proxy): |
1836 | """Construct a `BlockingProxy`. |
1837 | |
1838 | - :param proxy: An xmlrpc_client.ServerProxy. |
1839 | + :param proxy: An xmlrpc.client.ServerProxy. |
1840 | """ |
1841 | self._proxy = proxy |
1842 | |
1843 | @@ -39,7 +39,7 @@ class DeferredBlockingProxy(BlockingProxy): |
1844 | |
1845 | This is almost exactly like 'BlockingProxy', except that this returns |
1846 | Deferreds. It is guaranteed to be exactly as synchronous as the passed-in |
1847 | - proxy. That means if you pass in a normal xmlrpc_client proxy you ought to |
1848 | + proxy. That means if you pass in a normal xmlrpc.client proxy you ought to |
1849 | be able to use `lp.services.twistedsupport.extract_result` to get the |
1850 | result. |
1851 | """ |
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 | """Definition of the internet servers that Launchpad uses.""" |
1858 | |
1859 | import threading |
1860 | +import xmlrpc.client |
1861 | |
1862 | from lazr.restful.interfaces import ( |
1863 | ICollectionResource, |
1864 | @@ -17,7 +18,6 @@ from lazr.restful.publisher import ( |
1865 | from lazr.restful.utils import get_current_browser_request |
1866 | from lazr.uri import URI |
1867 | import six |
1868 | -from six.moves import xmlrpc_client |
1869 | from six.moves.urllib.parse import parse_qs |
1870 | from talisker.logs import logging_context |
1871 | import transaction |
1872 | @@ -1403,15 +1403,15 @@ class PublicXMLRPCResponse(XMLRPCResponse): |
1873 | """Response type for doing public XML-RPC in Launchpad.""" |
1874 | |
1875 | def handleException(self, exc_info): |
1876 | - # If we don't have a proper xmlrpc_client.Fault, and we have |
1877 | + # If we don't have a proper xmlrpc.client.Fault, and we have |
1878 | # logged an OOPS, create a Fault that reports the OOPS ID to |
1879 | # the user. |
1880 | exc_value = exc_info[1] |
1881 | - if not isinstance(exc_value, xmlrpc_client.Fault): |
1882 | + if not isinstance(exc_value, xmlrpc.client.Fault): |
1883 | request = get_current_browser_request() |
1884 | if request is not None and request.oopsid is not None: |
1885 | - exc_info = (xmlrpc_client.Fault, |
1886 | - xmlrpc_client.Fault(-1, request.oopsid), |
1887 | + exc_info = (xmlrpc.client.Fault, |
1888 | + xmlrpc.client.Fault(-1, request.oopsid), |
1889 | None) |
1890 | XMLRPCResponse.handleException(self, exc_info) |
1891 | |
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 | ] |
1898 | |
1899 | import socket |
1900 | +import xmlrpc.client |
1901 | |
1902 | from defusedxml.xmlrpc import monkey_patch |
1903 | -from six.moves import xmlrpc_client |
1904 | |
1905 | |
1906 | # Protect against various XML parsing vulnerabilities. |
1907 | monkey_patch() |
1908 | |
1909 | |
1910 | -class LaunchpadFault(xmlrpc_client.Fault): |
1911 | +class LaunchpadFault(xmlrpc.client.Fault): |
1912 | """Base class for a Launchpad XMLRPC fault. |
1913 | |
1914 | Subclasses should define a unique error_code and a msg_template, |
1915 | @@ -34,7 +34,7 @@ class LaunchpadFault(xmlrpc_client.Fault): |
1916 | assert self.msg_template is not None, ( |
1917 | "Subclasses must define msg_template.") |
1918 | msg = self.msg_template % kw |
1919 | - xmlrpc_client.Fault.__init__(self, self.error_code, msg) |
1920 | + xmlrpc.client.Fault.__init__(self, self.error_code, msg) |
1921 | |
1922 | def __eq__(self, other): |
1923 | if not isinstance(other, LaunchpadFault): |
1924 | @@ -47,19 +47,19 @@ class LaunchpadFault(xmlrpc_client.Fault): |
1925 | return not (self == other) |
1926 | |
1927 | |
1928 | -class Transport(xmlrpc_client.Transport): |
1929 | - """An xmlrpc_client transport that supports a timeout argument. |
1930 | +class Transport(xmlrpc.client.Transport): |
1931 | + """An xmlrpc.client transport that supports a timeout argument. |
1932 | |
1933 | Use by passing into the "transport" argument of the |
1934 | - xmlrpc_client.ServerProxy initialization. |
1935 | + xmlrpc.client.ServerProxy initialization. |
1936 | """ |
1937 | |
1938 | def __init__(self, |
1939 | use_datetime=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): |
1940 | - xmlrpc_client.Transport.__init__(self, use_datetime) |
1941 | + xmlrpc.client.Transport.__init__(self, use_datetime) |
1942 | self.timeout = timeout |
1943 | |
1944 | def make_connection(self, host): |
1945 | - conn = xmlrpc_client.Transport.make_connection(self, host) |
1946 | + conn = xmlrpc.client.Transport.make_connection(self, host) |
1947 | conn.timeout = self.timeout |
1948 | 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 | base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs( |
1955 | logger=logger) |
1956 | # Non-trivial metadata values may have been security-wrapped, which |
1957 | - # is pointless here and just gets in the way of xmlrpc_client |
1958 | + # is pointless here and just gets in the way of xmlrpc.client |
1959 | # serialisation. |
1960 | args = dict(removeSecurityProxy(build.livefs.metadata)) |
1961 | 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 | import string |
1968 | import sys |
1969 | import time |
1970 | - |
1971 | -import six |
1972 | -from six.moves.xmlrpc_client import ( |
1973 | +from xmlrpc.client import ( |
1974 | Fault, |
1975 | ServerProxy, |
1976 | ) |
1977 | |
1978 | +import six |
1979 | + |
1980 | from lp.services.config import config |
1981 | from lp.services.memcache.client import memcache_client_factory |
1982 | |
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 | |
1989 | import http.client as http_client |
1990 | import io |
1991 | +import xmlrpc.client |
1992 | |
1993 | -from six.moves import xmlrpc_client |
1994 | from zope.security.management import ( |
1995 | endInteraction, |
1996 | queryInteraction, |
1997 | @@ -38,7 +38,7 @@ class _FakeSocket(object): |
1998 | class TestHTTPConnection(http_client.HTTPConnection): |
1999 | """A HTTPConnection which talks to http() instead of a real server. |
2000 | |
2001 | - Only the methods called by xmlrpc_client are overridden. |
2002 | + Only the methods called by xmlrpc.client are overridden. |
2003 | """ |
2004 | |
2005 | _data_to_send = b'' |
2006 | @@ -76,7 +76,7 @@ class TestHTTPConnection(http_client.HTTPConnection): |
2007 | return response |
2008 | |
2009 | |
2010 | -class XMLRPCTestTransport(xmlrpc_client.Transport): |
2011 | +class XMLRPCTestTransport(xmlrpc.client.Transport): |
2012 | """An XMLRPC Transport which sends the requests to http().""" |
2013 | |
2014 | 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 | 'SelfTest', |
2021 | ] |
2022 | |
2023 | -from six.moves import xmlrpc_client |
2024 | +import xmlrpc.client |
2025 | + |
2026 | from zope.component import getUtility |
2027 | from zope.interface import ( |
2028 | implementer, |
2029 | @@ -104,7 +105,7 @@ class SelfTest(LaunchpadXMLRPCView): |
2030 | |
2031 | def make_fault(self): |
2032 | """Returns an xmlrpc fault.""" |
2033 | - return xmlrpc_client.Fault(666, "Yoghurt and spanners.") |
2034 | + return xmlrpc.client.Fault(666, "Yoghurt and spanners.") |
2035 | |
2036 | def concatenate(self, string1, string2): |
2037 | """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 | /> |
2044 | |
2045 | <class class="lp.xmlrpc.faults.BranchAlreadyRegistered"> |
2046 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2047 | + <require like_class="xmlrpc.client.Fault" /> |
2048 | </class> |
2049 | |
2050 | <class class="lp.xmlrpc.faults.FileBugGotProductAndDistro"> |
2051 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2052 | + <require like_class="xmlrpc.client.Fault" /> |
2053 | </class> |
2054 | |
2055 | <class |
2056 | class="lp.xmlrpc.faults.FileBugMissingProductOrDistribution" |
2057 | > |
2058 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2059 | + <require like_class="xmlrpc.client.Fault" /> |
2060 | </class> |
2061 | |
2062 | <class class="lp.xmlrpc.faults.NoSuchDistribution"> |
2063 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2064 | + <require like_class="xmlrpc.client.Fault" /> |
2065 | </class> |
2066 | |
2067 | <class class="lp.xmlrpc.faults.NoSuchPackage"> |
2068 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2069 | + <require like_class="xmlrpc.client.Fault" /> |
2070 | </class> |
2071 | |
2072 | <class class="lp.xmlrpc.faults.NoSuchProduct"> |
2073 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2074 | + <require like_class="xmlrpc.client.Fault" /> |
2075 | </class> |
2076 | |
2077 | <class class="lp.xmlrpc.faults.NoSuchPerson"> |
2078 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2079 | + <require like_class="xmlrpc.client.Fault" /> |
2080 | </class> |
2081 | |
2082 | <class class="lp.xmlrpc.faults.NoSuchPersonWithName"> |
2083 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2084 | + <require like_class="xmlrpc.client.Fault" /> |
2085 | </class> |
2086 | |
2087 | <class class="lp.xmlrpc.faults.NoSuchBranch"> |
2088 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2089 | + <require like_class="xmlrpc.client.Fault" /> |
2090 | </class> |
2091 | |
2092 | <class class="lp.xmlrpc.faults.NoSuchBug"> |
2093 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2094 | + <require like_class="xmlrpc.client.Fault" /> |
2095 | </class> |
2096 | |
2097 | <class class="lp.xmlrpc.faults.RequiredParameterMissing"> |
2098 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2099 | + <require like_class="xmlrpc.client.Fault" /> |
2100 | </class> |
2101 | |
2102 | <class class="lp.xmlrpc.faults.BranchCreationForbidden"> |
2103 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2104 | + <require like_class="xmlrpc.client.Fault" /> |
2105 | </class> |
2106 | |
2107 | <class class="lp.xmlrpc.faults.InvalidBranchUrl"> |
2108 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2109 | + <require like_class="xmlrpc.client.Fault" /> |
2110 | </class> |
2111 | |
2112 | <class class="lp.xmlrpc.faults.BranchUniqueNameConflict"> |
2113 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2114 | + <require like_class="xmlrpc.client.Fault" /> |
2115 | </class> |
2116 | |
2117 | <class class="lp.xmlrpc.faults.NoSuchTeamMailingList"> |
2118 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2119 | + <require like_class="xmlrpc.client.Fault" /> |
2120 | </class> |
2121 | |
2122 | <class class="lp.xmlrpc.faults.UnexpectedStatusReport"> |
2123 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2124 | + <require like_class="xmlrpc.client.Fault" /> |
2125 | </class> |
2126 | |
2127 | <class class="lp.xmlrpc.faults.BadStatus"> |
2128 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2129 | + <require like_class="xmlrpc.client.Fault" /> |
2130 | </class> |
2131 | |
2132 | <class class="lp.xmlrpc.faults.NoLinkedBranch"> |
2133 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2134 | + <require like_class="xmlrpc.client.Fault" /> |
2135 | </class> |
2136 | |
2137 | <class class="lp.xmlrpc.faults.NoSuchProductSeries"> |
2138 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2139 | + <require like_class="xmlrpc.client.Fault" /> |
2140 | </class> |
2141 | |
2142 | <class class="lp.xmlrpc.faults.InvalidBranchIdentifier"> |
2143 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2144 | + <require like_class="xmlrpc.client.Fault" /> |
2145 | </class> |
2146 | |
2147 | <class class="lp.xmlrpc.faults.BranchNameInUse"> |
2148 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2149 | + <require like_class="xmlrpc.client.Fault" /> |
2150 | </class> |
2151 | |
2152 | <class class="lp.xmlrpc.faults.CannotHaveLinkedBranch"> |
2153 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2154 | + <require like_class="xmlrpc.client.Fault" /> |
2155 | </class> |
2156 | |
2157 | <class class="lp.xmlrpc.faults.InvalidProductName"> |
2158 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2159 | + <require like_class="xmlrpc.client.Fault" /> |
2160 | </class> |
2161 | |
2162 | <class class="lp.xmlrpc.faults.NotInTeam"> |
2163 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2164 | + <require like_class="xmlrpc.client.Fault" /> |
2165 | </class> |
2166 | |
2167 | <class class="lp.xmlrpc.faults.InvalidBranchName"> |
2168 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2169 | + <require like_class="xmlrpc.client.Fault" /> |
2170 | </class> |
2171 | |
2172 | <class class="lp.xmlrpc.faults.NoBranchWithID"> |
2173 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2174 | + <require like_class="xmlrpc.client.Fault" /> |
2175 | </class> |
2176 | |
2177 | <class class="lp.xmlrpc.faults.NoUrlForBranch"> |
2178 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2179 | + <require like_class="xmlrpc.client.Fault" /> |
2180 | </class> |
2181 | |
2182 | <class class="lp.xmlrpc.faults.PathTranslationError"> |
2183 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2184 | + <require like_class="xmlrpc.client.Fault" /> |
2185 | </class> |
2186 | |
2187 | <class class="lp.xmlrpc.faults.InvalidPath"> |
2188 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2189 | + <require like_class="xmlrpc.client.Fault" /> |
2190 | </class> |
2191 | |
2192 | <class class="lp.xmlrpc.faults.PermissionDenied"> |
2193 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2194 | + <require like_class="xmlrpc.client.Fault" /> |
2195 | </class> |
2196 | |
2197 | <class class="lp.xmlrpc.faults.NotFound"> |
2198 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2199 | + <require like_class="xmlrpc.client.Fault" /> |
2200 | </class> |
2201 | |
2202 | <class class="lp.xmlrpc.faults.InvalidBranchUniqueName"> |
2203 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2204 | + <require like_class="xmlrpc.client.Fault" /> |
2205 | </class> |
2206 | |
2207 | <class class="lp.xmlrpc.faults.NoSuchDistroSeries"> |
2208 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2209 | + <require like_class="xmlrpc.client.Fault" /> |
2210 | </class> |
2211 | |
2212 | <class class="lp.xmlrpc.faults.NoSuchSourcePackageName"> |
2213 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2214 | + <require like_class="xmlrpc.client.Fault" /> |
2215 | </class> |
2216 | |
2217 | <class class="lp.xmlrpc.faults.InvalidSourcePackageName"> |
2218 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2219 | + <require like_class="xmlrpc.client.Fault" /> |
2220 | </class> |
2221 | |
2222 | <class class="lp.xmlrpc.faults.Unauthorized"> |
2223 | - <require like_class="six.moves.xmlrpc_client.Fault" /> |
2224 | + <require like_class="xmlrpc.client.Fault" /> |
2225 | </class> |
2226 | </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 | 'return_fault', |
2233 | ] |
2234 | |
2235 | -from six.moves.xmlrpc_client import Fault |
2236 | +from xmlrpc.client import Fault |
2237 | + |
2238 | from twisted.python.util import mergeFunctionMetadata |
2239 | |
2240 | |
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 | """Private XMLRPC tests. |
2247 | """ |
2248 | |
2249 | -from six.moves import xmlrpc_client |
2250 | +import xmlrpc.client |
2251 | + |
2252 | from zope.component import getUtility |
2253 | |
2254 | from lp.services.verification.interfaces.logintoken import ILoginTokenSet |
2255 | @@ -30,14 +31,14 @@ class TestPrivateXMLRPC(TestCase): |
2256 | private_root = 'http://xmlrpc-private.launchpad.test:8087/' |
2257 | |
2258 | def get_public_proxy(self, path): |
2259 | - """Get an xmlrpc_client.ServerProxy pointing at the public URL""" |
2260 | - return xmlrpc_client.ServerProxy( |
2261 | + """Get an xmlrpc.client.ServerProxy pointing at the public URL""" |
2262 | + return xmlrpc.client.ServerProxy( |
2263 | self.public_root + path, |
2264 | transport=XMLRPCTestTransport()) |
2265 | |
2266 | def get_private_proxy(self, path): |
2267 | - """Get an xmlrpc_client.ServerProxy pointing at the private URL""" |
2268 | - return xmlrpc_client.ServerProxy( |
2269 | + """Get an xmlrpc.client.ServerProxy pointing at the private URL""" |
2270 | + return xmlrpc.client.ServerProxy( |
2271 | self.private_root + path, |
2272 | transport=XMLRPCTestTransport()) |
2273 | |
2274 | @@ -47,7 +48,7 @@ class TestPrivateXMLRPC(TestCase): |
2275 | not available on the external XML-RPC port. |
2276 | """ |
2277 | external_api = self.get_public_proxy('mailinglists/') |
2278 | - e = self.assertRaises(xmlrpc_client.ProtocolError, |
2279 | + e = self.assertRaises(xmlrpc.client.ProtocolError, |
2280 | external_api.getPendingActions) |
2281 | self.assertEqual(404, e.errcode) |
2282 | |
2283 | @@ -77,7 +78,7 @@ class TestPrivateXMLRPC(TestCase): |
2284 | internal_api = self.get_private_proxy('bugs/') |
2285 | bug_dict = dict( |
2286 | product='firefox', summary='the summary', comment='the comment') |
2287 | - e = self.assertRaises(xmlrpc_client.ProtocolError, |
2288 | + e = self.assertRaises(xmlrpc.client.ProtocolError, |
2289 | internal_api.filebug, bug_dict) |
2290 | self.assertEqual(404, e.errcode) |
2291 | |
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 | """XMLRPC self-test api. |
2298 | """ |
2299 | |
2300 | -from six.moves import xmlrpc_client |
2301 | +import xmlrpc.client |
2302 | + |
2303 | from zope.component import getUtility |
2304 | |
2305 | from lp.services.webapp.interfaces import ILaunchBag |
2306 | @@ -27,11 +28,11 @@ class TestXMLRPCSelfTest(TestCaseWithFactory): |
2307 | layer = LaunchpadFunctionalLayer |
2308 | |
2309 | def make_proxy(self): |
2310 | - return xmlrpc_client.ServerProxy( |
2311 | + return xmlrpc.client.ServerProxy( |
2312 | 'http://xmlrpc.launchpad.test/', transport=XMLRPCTestTransport()) |
2313 | |
2314 | def make_logged_in_proxy(self): |
2315 | - return xmlrpc_client.ServerProxy( |
2316 | + return xmlrpc.client.ServerProxy( |
2317 | 'http://test@canonical.com:test@xmlrpc.launchpad.test/', |
2318 | transport=XMLRPCTestTransport()) |
2319 | |
2320 | @@ -46,17 +47,17 @@ class TestXMLRPCSelfTest(TestCaseWithFactory): |
2321 | self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault)) |
2322 | |
2323 | def test_custom_transport(self): |
2324 | - """We can test our XMLRPC APIs using xmlrpc_client, using a custom |
2325 | + """We can test our XMLRPC APIs using xmlrpc.client, using a custom |
2326 | Transport which talks with the publisher directly. |
2327 | """ |
2328 | selftest = self.make_proxy() |
2329 | self.assertEqual('foo bar', selftest.concatenate('foo', 'bar')) |
2330 | - fault = self.assertRaises(xmlrpc_client.Fault, selftest.make_fault) |
2331 | + fault = self.assertRaises(xmlrpc.client.Fault, selftest.make_fault) |
2332 | self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault)) |
2333 | |
2334 | def test_unexpected_exception(self): |
2335 | """Sometimes an XML-RPC method will be buggy, and raise an exception |
2336 | - other than xmlrpc_client.Fault. We have such a method on the self |
2337 | + other than xmlrpc.client.Fault. We have such a method on the self |
2338 | test view. |
2339 | """ |
2340 | selftestview = SelfTest('somecontext', 'somerequest') |
2341 | @@ -69,7 +70,7 @@ class TestXMLRPCSelfTest(TestCaseWithFactory): |
2342 | one was generated): |
2343 | """ |
2344 | selftest = self.make_proxy() |
2345 | - e = self.assertRaises(xmlrpc_client.Fault, selftest.raise_exception) |
2346 | + e = self.assertRaises(xmlrpc.client.Fault, selftest.raise_exception) |
2347 | self.assertStartsWith(str(e), "<Fault -1: 'OOPS-") |
2348 | |
2349 | def test_anonymous_authentication(self): |
I'll take a look throughout the day - will take some time, obviously :-)