Merge ~cjwatson/launchpad:six-xmlrpclib into launchpad:master

Proposed by Colin Watson on 2020-02-19
Status: Merged
Approved by: Colin Watson on 2020-02-24
Approved revision: 31717d765d257c583472c6584b28a721b92bacae
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:six-xmlrpclib
Merge into: launchpad:master
Diff against target: 2112 lines (+261/-262)
54 files modified
cronscripts/code-import-dispatcher.py (+1/-1)
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 (+4/-3)
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 (+2/-1)
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 (+1/-1)
lib/lp/bugs/tests/externalbugtracker.py (+26/-25)
lib/lp/bugs/tests/trac-xmlrpc-transport.txt (+2/-2)
lib/lp/buildmaster/model/buildqueue.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/xmlrpc/branch.py (+1/-1)
lib/lp/code/xmlrpc/tests/test_branch.py (+2/-2)
lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py (+4/-5)
lib/lp/codehosting/inmemory.py (+1/-1)
lib/lp/codehosting/tests/test_acceptance.py (+3/-3)
lib/lp/codehosting/vfs/branchfs.py (+5/-4)
lib/lp/codehosting/vfs/tests/test_branchfs.py (+2/-2)
lib/lp/registry/tests/mailinglists_helper.py (+2/-4)
lib/lp/registry/tests/test_mailinglistapi.py (+2/-2)
lib/lp/registry/tests/test_xmlrpc.py (+4/-5)
lib/lp/registry/xmlrpc/mailinglist.py (+2/-2)
lib/lp/services/authserver/doc/xmlrpc-authserver.txt (+2/-2)
lib/lp/services/features/__init__.py (+1/-1)
lib/lp/services/features/tests/test_xmlrpc.py (+3/-3)
lib/lp/services/tests/test_timeout.py (+3/-3)
lib/lp/services/tests/test_xmlrpc.py (+1/-1)
lib/lp/services/timeout.py (+4/-4)
lib/lp/services/twistedsupport/xmlrpc.py (+6/-5)
lib/lp/services/webapp/servers.py (+5/-5)
lib/lp/services/xmlrpc.py (+9/-9)
lib/lp/soyuz/model/livefsbuildbehaviour.py (+1/-1)
lib/lp/testing/xmlrpc.py (+6/-4)
lib/lp/xmlrpc/application.py (+2/-3)
lib/lp/xmlrpc/configure.zcml (+36/-36)
lib/lp/xmlrpc/helpers.py (+1/-2)
lib/lp/xmlrpc/tests/test_private_xmlrpc.py (+7/-8)
lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py (+8/-9)
Reviewer Review Type Date Requested Status
Kristian Glass 2020-02-19 Approve on 2020-02-24
Review via email: mp+379509@code.launchpad.net

Commit message

Import xmlrpclib from six.moves.xmlrpc_client

Description of the change

This part of the standard library was rearranged in Python 3.

To post a comment you must log in.
Kristian Glass (doismellburning) wrote :

Due to size and mechanical nature I've not fully reviewed this, but sampling it, it looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cronscripts/code-import-dispatcher.py b/cronscripts/code-import-dispatcher.py
2index 0bcf6b1..df269ca 100755
3--- a/cronscripts/code-import-dispatcher.py
4+++ b/cronscripts/code-import-dispatcher.py
5@@ -7,7 +7,7 @@
6
7 import _pythonpath
8
9-from xmlrpclib import ServerProxy
10+from six.moves.xmlrpc_client import ServerProxy
11
12 from lp.codehosting.codeimport.dispatcher import CodeImportDispatcher
13 from lp.services.config import config
14diff --git a/lib/launchpad_loggerhead/app.py b/lib/launchpad_loggerhead/app.py
15index 59225d7..a671d73 100644
16--- a/lib/launchpad_loggerhead/app.py
17+++ b/lib/launchpad_loggerhead/app.py
18@@ -4,7 +4,6 @@
19 import logging
20 import os
21 import threading
22-import xmlrpclib
23
24 from breezy import (
25 errors,
26@@ -40,6 +39,7 @@ from paste.request import (
27 parse_querystring,
28 path_info_pop,
29 )
30+from six.moves import xmlrpc_client
31 from six.moves.urllib.parse import (
32 urlencode,
33 urljoin,
34@@ -75,7 +75,7 @@ set_default_openid_fetcher()
35 def check_fault(fault, *fault_classes):
36 """Check if 'fault's faultCode matches any of 'fault_classes'.
37
38- :param fault: An instance of `xmlrpclib.Fault`.
39+ :param fault: An instance of `xmlrpc_client.Fault`.
40 :param fault_classes: Any number of `LaunchpadFault` subclasses.
41 """
42 for cls in fault_classes:
43@@ -101,7 +101,7 @@ class RootApp:
44 def get_branchfs(self):
45 t = getattr(thread_locals, 'branchfs', None)
46 if t is None:
47- thread_locals.branchfs = xmlrpclib.ServerProxy(
48+ thread_locals.branchfs = xmlrpc_client.ServerProxy(
49 config.codehosting.codehosting_endpoint)
50 return thread_locals.branchfs
51
52@@ -224,7 +224,7 @@ class RootApp:
53 branchfs = self.get_branchfs()
54 transport_type, info, trail = branchfs.translatePath(
55 identity_url, urlutils.escape(path))
56- except xmlrpclib.Fault as f:
57+ except xmlrpc_client.Fault as f:
58 if check_fault(f, faults.PathTranslationError):
59 raise HTTPNotFound()
60 elif check_fault(f, faults.PermissionDenied):
61diff --git a/lib/lp/app/stories/basics/xx-opstats.txt b/lib/lp/app/stories/basics/xx-opstats.txt
62index 47e7780..655b7d0 100644
63--- a/lib/lp/app/stories/basics/xx-opstats.txt
64+++ b/lib/lp/app/stories/basics/xx-opstats.txt
65@@ -4,9 +4,9 @@ Operational Statistics and Metrics
66 We make Zope 3 give us real time statistics about Launchpad's operation.
67 We can access them via XML-RPC:
68
69- >>> import xmlrpclib
70+ >>> from six.moves import xmlrpc_client
71 >>> from lp.testing.xmlrpc import XMLRPCTestTransport
72- >>> lp_xmlrpc = xmlrpclib.ServerProxy(
73+ >>> lp_xmlrpc = xmlrpc_client.ServerProxy(
74 ... 'http://xmlrpc.launchpad.test/+opstats',
75 ... transport=XMLRPCTestTransport()
76 ... )
77@@ -147,7 +147,7 @@ Number of XML-RPC Faults
78 >>> try:
79 ... opstats = lp_xmlrpc.invalid() # XXX: Need a HTTP test too
80 ... print 'Should have raised a Fault exception!'
81- ... except xmlrpclib.Fault:
82+ ... except xmlrpc_client.Fault:
83 ... pass
84 >>> report()
85 requests: 1
86diff --git a/lib/lp/bugs/doc/bugtracker-tokens.txt b/lib/lp/bugs/doc/bugtracker-tokens.txt
87index 630209c..a32f050 100644
88--- a/lib/lp/bugs/doc/bugtracker-tokens.txt
89+++ b/lib/lp/bugs/doc/bugtracker-tokens.txt
90@@ -3,12 +3,12 @@ Using BugTracker Login Tokens
91
92 Launchpad offers an XML-RPC interface for generating bug tracker tokens.
93
94- >>> import xmlrpclib
95+ >>> from six.moves import xmlrpc_client
96 >>> from zope.component import getUtility
97 >>> from lp.testing.xmlrpc import XMLRPCTestTransport
98 >>> from lp.services.verification.interfaces.logintoken import (
99 ... ILoginTokenSet)
100- >>> bugtracker_api = xmlrpclib.ServerProxy(
101+ >>> bugtracker_api = xmlrpc_client.ServerProxy(
102 ... 'http://xmlrpc-private.launchpad.test:8087/bugs',
103 ... transport=XMLRPCTestTransport())
104
105diff --git a/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt b/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt
106index ce19c31..465265e 100644
107--- a/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt
108+++ b/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt
109@@ -130,7 +130,7 @@ login_required() and will retry the method call.
110
111 If authentication fails, a BugTrackerAuthenticationError will be raised.
112
113- >>> from xmlrpclib import Fault, ProtocolError
114+ >>> from six.moves.xmlrpc_client import Fault, ProtocolError
115 >>> class TestAuthFailingBugzillaXMLRPCTransport(
116 ... ZopelessBugzillaXMLRPCTransport):
117 ... error = Fault(100, "Sorry, you can't log in.")
118diff --git a/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt b/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt
119index 0230d40..ddaf53b 100644
120--- a/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt
121+++ b/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt
122@@ -86,25 +86,25 @@ ExternalBugTracker will be returned.
123 The Bugzilla ExternalBugTracker has a _test_xmlrpc_proxy property which
124 we override for the purpose of this test.
125
126- >>> import xmlrpclib
127- >>> class FailingXMLRPCTransport(xmlrpclib.Transport):
128+ >>> from six.moves import xmlrpc_client
129+ >>> class FailingXMLRPCTransport(xmlrpc_client.Transport):
130 ...
131- ... error = xmlrpclib.Fault(
132- ... xmlrpclib.METHOD_NOT_FOUND, "Method doesn't exist")
133+ ... error = xmlrpc_client.Fault(
134+ ... xmlrpc_client.METHOD_NOT_FOUND, "Method doesn't exist")
135 ...
136 ... def request(self, host, handler, request, verbose=None):
137 ... if self.error is not None:
138 ... raise self.error
139 ... else:
140 ... # We need to return something here, otherwise
141- ... # xmlrpclib will explode.
142+ ... # xmlrpc_client will explode.
143 ... return '0.42-test'
144 ...
145 >>> test_transport = FailingXMLRPCTransport()
146
147 >>> class BugzillaWithFakeProxy(Bugzilla):
148 ...
149- ... _test_xmlrpc_proxy = xmlrpclib.ServerProxy(
150+ ... _test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
151 ... 'http://example.com/xmlrpc.cgi', transport=test_transport)
152
153 >>> bugzilla = BugzillaWithFakeProxy('http://example.com')
154@@ -129,7 +129,7 @@ BugzillaAPI instance.
155 The same is true if getExternalBugTrackerToUse() receives a 404 error
156 from the remote server.
157
158- >>> test_transport.error = xmlrpclib.ProtocolError(
159+ >>> test_transport.error = xmlrpc_client.ProtocolError(
160 ... 'http://example.com/xmlrpc.cgi', 404, 'Not Found', None)
161
162 >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse()
163@@ -141,7 +141,7 @@ from the remote server.
164 Some Bugzillas respond to an invalid XML-RPC method call by returning a
165 500 error. getExternalBugTrackerToUse() handles those, too.
166
167- >>> test_transport.error = xmlrpclib.ProtocolError(
168+ >>> test_transport.error = xmlrpc_client.ProtocolError(
169 ... 'http://example.com/xmlrpc.cgi', 500, 'Server Error', None)
170
171 >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse()
172@@ -153,7 +153,7 @@ Some Bugzillas respond to an invalid XML-RPC method call by returning a
173 Some other Bugzillas generate an unparsable response, causing
174 ResponseError to be raised.
175
176- >>> test_transport.error = xmlrpclib.ResponseError()
177+ >>> test_transport.error = xmlrpc_client.ResponseError()
178 >>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse()
179
180 >>> (isinstance(bugzilla_to_use, Bugzilla) and
181@@ -164,22 +164,22 @@ If the remote Bugzilla offers the Bugzilla 3.4 API, an instance of
182 BuzillaAPI will be returned. To test this, we use a specially-crafted
183 XML-RPC proxy that behaves like a Bugzilla 3.4 instance.
184
185- >>> class APIXMLRPCTransport(xmlrpclib.Transport):
186+ >>> class APIXMLRPCTransport(xmlrpc_client.Transport):
187 ...
188 ... version = '3.4.2'
189 ...
190 ... def request(self, host, handler, request, verbose=None):
191- ... args, method_name = xmlrpclib.loads(request)
192+ ... args, method_name = xmlrpc_client.loads(request)
193 ...
194 ... if method_name == 'Bugzilla.version':
195 ... return [{'version': self.version}]
196 ... else:
197- ... raise xmlrpclib.Fault(
198- ... xmlrpclib.METHOD_NOT_FOUND, 'No such method')
199+ ... raise xmlrpc_client.Fault(
200+ ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method')
201 ...
202 >>> test_transport = APIXMLRPCTransport()
203
204- >>> bugzilla._test_xmlrpc_proxy = xmlrpclib.ServerProxy(
205+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
206 ... 'http://example.com/xmlrpc.cgi',
207 ... transport=test_transport)
208
209@@ -193,7 +193,7 @@ A version older than 3.4 is not accepted.
210 >>> test_transport = APIXMLRPCTransport()
211 >>> test_transport.version = '3.3'
212
213- >>> bugzilla._test_xmlrpc_proxy = xmlrpclib.ServerProxy(
214+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
215 ... 'http://example.com/xmlrpc.cgi',
216 ... transport=test_transport)
217
218@@ -206,7 +206,7 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted.
219 >>> test_transport = APIXMLRPCTransport()
220 >>> test_transport.version = '20181108.1'
221
222- >>> bugzilla._test_xmlrpc_proxy = xmlrpclib.ServerProxy(
223+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
224 ... 'http://example.com/xmlrpc.cgi',
225 ... transport=test_transport)
226
227@@ -218,20 +218,20 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted.
228 If the remote system has the Launchpad plugin installed, an
229 getExternalBugTrackerToUse() will return a BugzillaLPPlugin instance.
230
231- >>> class PluginXMLRPCTransport(xmlrpclib.Transport):
232+ >>> class PluginXMLRPCTransport(xmlrpc_client.Transport):
233 ...
234 ... def request(self, host, handler, request, verbose=None):
235- ... args, method_name = xmlrpclib.loads(request)
236+ ... args, method_name = xmlrpc_client.loads(request)
237 ...
238 ... if method_name == 'Launchpad.plugin_version':
239 ... return [{'version': '0.2'}]
240 ... else:
241- ... raise xmlrpclib.Fault(
242- ... xmlrpclib.METHOD_NOT_FOUND, 'No such method')
243+ ... raise xmlrpc_client.Fault(
244+ ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method')
245 ...
246 >>> test_transport = PluginXMLRPCTransport()
247
248- >>> bugzilla._test_xmlrpc_proxy = xmlrpclib.ServerProxy(
249+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
250 ... 'http://example.com/xmlrpc.cgi',
251 ... transport=test_transport)
252
253@@ -244,19 +244,19 @@ in response to XML-RPC calls. When something other than a mapping is
254 returned, the standard non-API non-plugin external bug tracker is
255 selected.
256
257- >>> class OldXMLRPCTransport(xmlrpclib.Transport):
258+ >>> class OldXMLRPCTransport(xmlrpc_client.Transport):
259 ... def request(self, host, handler, request, verbose=None):
260- ... args, method_name = xmlrpclib.loads(request)
261+ ... args, method_name = xmlrpc_client.loads(request)
262 ...
263 ... if method_name == 'Bugzilla.version':
264 ... return ('versionResponse', {'version': '3.2.5+'})
265 ... else:
266- ... raise xmlrpclib.Fault(
267- ... xmlrpclib.METHOD_NOT_FOUND, 'No such method')
268+ ... raise xmlrpc_client.Fault(
269+ ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method')
270 ...
271 >>> test_transport = OldXMLRPCTransport()
272
273- >>> bugzilla._test_xmlrpc_proxy = xmlrpclib.ServerProxy(
274+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
275 ... 'http://example.com/xmlrpc.cgi',
276 ... transport=test_transport)
277
278@@ -270,18 +270,18 @@ is not discovered over XML-RPC. It's not clear if this is an error in
279 Bugzilla or in and XML-RPC library used by Bugzilla. In any case, we
280 recognize and treat it the same as METHOD_NOT_FOUND.
281
282- >>> class OldBrokenXMLRPCTransport(xmlrpclib.Transport):
283+ >>> class OldBrokenXMLRPCTransport(xmlrpc_client.Transport):
284 ... def request(self, host, handler, request, verbose=None):
285- ... args, method_name = xmlrpclib.loads(request)
286+ ... args, method_name = xmlrpc_client.loads(request)
287 ...
288 ... if method_name == 'Bugzilla.version':
289 ... return ('versionResponse', {'version': '3.2.5+'})
290 ... else:
291- ... raise xmlrpclib.Fault('Client', 'No such method')
292+ ... raise xmlrpc_client.Fault('Client', 'No such method')
293 ...
294 >>> test_transport = OldBrokenXMLRPCTransport()
295
296- >>> bugzilla._test_xmlrpc_proxy = xmlrpclib.ServerProxy(
297+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
298 ... 'http://example.com/xmlrpc.cgi',
299 ... transport=test_transport)
300
301diff --git a/lib/lp/bugs/doc/malone-xmlrpc.txt b/lib/lp/bugs/doc/malone-xmlrpc.txt
302index 1d4ace3..465dca7 100644
303--- a/lib/lp/bugs/doc/malone-xmlrpc.txt
304+++ b/lib/lp/bugs/doc/malone-xmlrpc.txt
305@@ -3,9 +3,9 @@ XML-RPC Integration with Malone
306
307 Malone provides an XML-RPC interface for filing bugs.
308
309- >>> import xmlrpclib
310+ >>> from six.moves import xmlrpc_client
311 >>> from lp.testing.xmlrpc import XMLRPCTestTransport
312- >>> filebug_api = xmlrpclib.ServerProxy(
313+ >>> filebug_api = xmlrpc_client.ServerProxy(
314 ... 'http://test@canonical.com:test@xmlrpc.launchpad.test/bugs/',
315 ... transport=XMLRPCTestTransport())
316
317@@ -277,7 +277,7 @@ The LoginToken generated will be of the LoginTokenType BUGTRACKER.
318
319 These requests are all handled by the private xml-rpc server.
320
321- >>> bugtracker_api = xmlrpclib.ServerProxy(
322+ >>> bugtracker_api = xmlrpc_client.ServerProxy(
323 ... 'http://xmlrpc-private.launchpad.test:8087/bugs',
324 ... transport=XMLRPCTestTransport())
325
326diff --git a/lib/lp/bugs/externalbugtracker/bugzilla.py b/lib/lp/bugs/externalbugtracker/bugzilla.py
327index ffdb35e..43f8c74 100644
328--- a/lib/lp/bugs/externalbugtracker/bugzilla.py
329+++ b/lib/lp/bugs/externalbugtracker/bugzilla.py
330@@ -15,12 +15,12 @@ from email.utils import parseaddr
331 import re
332 import string
333 import xml.parsers.expat
334-import xmlrpclib
335
336 from defusedxml import minidom
337 import pytz
338 import requests
339 import six
340+from six.moves import xmlrpc_client
341 from six.moves.http_client import BadStatusLine
342 from zope.component import getUtility
343 from zope.interface import (
344@@ -92,15 +92,15 @@ class Bugzilla(ExternalBugTracker):
345 # We try calling Bugzilla.version() on the remote
346 # server because it's the most lightweight method there is.
347 remote_version = proxy.Bugzilla.version()
348- except xmlrpclib.Fault as fault:
349+ except xmlrpc_client.Fault as fault:
350 # 'Client' is a hangover. Either Bugzilla or the Perl
351 # XML-RPC lib in use returned it as faultCode. It's wrong,
352 # but it's known wrongness, so we recognize it here.
353- if fault.faultCode in (xmlrpclib.METHOD_NOT_FOUND, 'Client'):
354+ if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'):
355 return False
356 else:
357 raise
358- except xmlrpclib.ProtocolError as error:
359+ except xmlrpc_client.ProtocolError as error:
360 # We catch 404s, which occur when xmlrpc.cgi doesn't exist
361 # on the remote server, and 500s, which sometimes occur when
362 # an invalid request is made to the remote server. We allow
363@@ -109,7 +109,7 @@ class Bugzilla(ExternalBugTracker):
364 return False
365 else:
366 raise
367- except (xmlrpclib.ResponseError, xml.parsers.expat.ExpatError):
368+ except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError):
369 # The server returned an unparsable response.
370 return False
371 else:
372@@ -134,15 +134,15 @@ class Bugzilla(ExternalBugTracker):
373 # We try calling Launchpad.plugin_version() on the remote
374 # server because it's the most lightweight method there is.
375 proxy.Launchpad.plugin_version()
376- except xmlrpclib.Fault as fault:
377+ except xmlrpc_client.Fault as fault:
378 # 'Client' is a hangover. Either Bugzilla or the Perl
379 # XML-RPC lib in use returned it as faultCode. It's wrong,
380 # but it's known wrongness, so we recognize it here.
381- if fault.faultCode in (xmlrpclib.METHOD_NOT_FOUND, 'Client'):
382+ if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'):
383 return False
384 else:
385 raise
386- except xmlrpclib.ProtocolError as error:
387+ except xmlrpc_client.ProtocolError as error:
388 # We catch 404s, which occur when xmlrpc.cgi doesn't exist
389 # on the remote server, and 500s, which sometimes occur when
390 # the Launchpad Plugin isn't installed. Everything else we
391@@ -152,7 +152,7 @@ class Bugzilla(ExternalBugTracker):
392 return False
393 else:
394 raise
395- except (xmlrpclib.ResponseError, xml.parsers.expat.ExpatError):
396+ except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError):
397 # The server returned an unparsable response.
398 return False
399 else:
400@@ -171,7 +171,7 @@ class Bugzilla(ExternalBugTracker):
401 return BugzillaLPPlugin(self.baseurl)
402 elif self._remoteSystemHasBugzillaAPI():
403 return BugzillaAPI(self.baseurl)
404- except (xmlrpclib.ProtocolError, requests.RequestException,
405+ except (xmlrpc_client.ProtocolError, requests.RequestException,
406 BadStatusLine):
407 pass
408 return self
409@@ -540,14 +540,14 @@ class Bugzilla(ExternalBugTracker):
410 def needs_authentication(func):
411 """Decorator for automatically authenticating if needed.
412
413- If an `xmlrpclib.Fault` with error code 410 is raised by the
414+ If an `xmlrpc_client.Fault` with error code 410 is raised by the
415 function, we'll try to authenticate and call the function again.
416 """
417
418 def decorator(self, *args, **kwargs):
419 try:
420 return func(self, *args, **kwargs)
421- except xmlrpclib.Fault as fault:
422+ except xmlrpc_client.Fault as fault:
423 # Catch authentication errors only.
424 if fault.faultCode != 410:
425 raise
426@@ -589,8 +589,8 @@ class BugzillaAPI(Bugzilla):
427
428 @property
429 def xmlrpc_proxy(self):
430- """Return an `xmlrpclib.ServerProxy` to self.xmlrpc_endpoint."""
431- return xmlrpclib.ServerProxy(
432+ """Return an `xmlrpc_client.ServerProxy` to self.xmlrpc_endpoint."""
433+ return xmlrpc_client.ServerProxy(
434 self.xmlrpc_endpoint, transport=self.xmlrpc_transport)
435
436 @property
437@@ -624,7 +624,7 @@ class BugzillaAPI(Bugzilla):
438 """
439 try:
440 self.xmlrpc_proxy.User.login(self.credentials)
441- except xmlrpclib.Fault as fault:
442+ except xmlrpc_client.Fault as fault:
443 raise BugTrackerAuthenticationError(
444 self.baseurl,
445 "Fault %s: %s" % (fault.faultCode, fault.faultString))
446@@ -974,7 +974,7 @@ class BugzillaLPPlugin(BugzillaAPI):
447 Bugzilla_logincookie, which we can then use to re-authenticate
448 ourselves for each subsequent method call.
449 """
450- internal_xmlrpc_server = xmlrpclib.ServerProxy(
451+ internal_xmlrpc_server = xmlrpc_client.ServerProxy(
452 config.checkwatches.xmlrpc_url,
453 transport=self.internal_xmlrpc_transport)
454
455@@ -983,12 +983,12 @@ class BugzillaLPPlugin(BugzillaAPI):
456 try:
457 self.xmlrpc_proxy.Launchpad.login(
458 {'token': token_text})
459- except xmlrpclib.Fault as fault:
460+ except xmlrpc_client.Fault as fault:
461 message = 'XML-RPC Fault: %s "%s"' % (
462 fault.faultCode, fault.faultString)
463 raise BugTrackerAuthenticationError(
464 self.baseurl, message)
465- except xmlrpclib.ProtocolError as error:
466+ except xmlrpc_client.ProtocolError as error:
467 message = 'Protocol error: %s "%s"' % (
468 error.errcode, error.errmsg)
469 raise BugTrackerAuthenticationError(
470diff --git a/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py b/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py
471index 12d5881..92447ac 100644
472--- a/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py
473+++ b/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py
474@@ -6,9 +6,9 @@
475 __metaclass__ = type
476
477 from xml.parsers.expat import ExpatError
478-import xmlrpclib
479
480 import responses
481+from six.moves import xmlrpc_client
482 import transaction
483
484 from lp.bugs.externalbugtracker.base import UnparsableBugData
485@@ -73,11 +73,11 @@ class TestBugzillaSniffing(TestCase):
486 # it is taken to mean that no XML-RPC capabilities exist.
487 bugzilla = Bugzilla("http://not.real")
488
489- class Transport(xmlrpclib.Transport):
490+ class Transport(xmlrpc_client.Transport):
491 def request(self, host, handler, request, verbose=None):
492 raise ExpatError("mismatched tag")
493
494- bugzilla._test_xmlrpc_proxy = xmlrpclib.ServerProxy(
495+ bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
496 '%s/xmlrpc.cgi' % bugzilla.baseurl, transport=Transport())
497
498 # We must abort any existing transactions before attempting to call
499diff --git a/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py b/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py
500index 6522ab8..3591e98 100644
501--- a/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py
502+++ b/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py
503@@ -22,15 +22,16 @@ class TestRequestsTransport(TestCase):
504
505 @responses.activate
506 def test_expat_error(self):
507- # Malformed XML-RPC responses cause xmlrpclib to raise an ExpatError.
508+ # Malformed XML-RPC responses cause xmlrpc_client to raise an
509+ # ExpatError.
510 responses.add(
511 "POST", "http://www.example.com/xmlrpc",
512 body="<params><mis></match></params>")
513 transport = RequestsTransport("http://not.real/")
514
515 # The Launchpad production environment selects Expat at present. This
516- # is quite strict compared to the other parsers that xmlrpclib can
517- # possibly select.
518+ # is quite strict compared to the other parsers that xmlrpc_client
519+ # can possibly select.
520 ensure_response_parser_is_expat(transport)
521
522 self.assertRaises(
523diff --git a/lib/lp/bugs/externalbugtracker/trac.py b/lib/lp/bugs/externalbugtracker/trac.py
524index 895f1aa..d10d8f2 100644
525--- a/lib/lp/bugs/externalbugtracker/trac.py
526+++ b/lib/lp/bugs/externalbugtracker/trac.py
527@@ -10,12 +10,12 @@ import csv
528 from datetime import datetime
529 from email.utils import parseaddr
530 import time
531-import xmlrpclib
532
533 from mimeparse import parse_mime_type
534 import pytz
535 import requests
536 from requests.cookies import RequestsCookieJar
537+from six.moves import xmlrpc_client
538 from zope.component import getUtility
539 from zope.interface import implementer
540
541@@ -304,14 +304,14 @@ class Trac(ExternalBugTracker):
542 def needs_authentication(func):
543 """Decorator for automatically authenticating if needed.
544
545- If an `xmlrpclib.ProtocolError` with error code 403 is raised by the
546+ If an `xmlrpc_client.ProtocolError` with error code 403 is raised by the
547 function, we'll try to authenticate and call the function again.
548 """
549
550 def decorator(self, *args, **kwargs):
551 try:
552 return func(self, *args, **kwargs)
553- except xmlrpclib.ProtocolError as error:
554+ except xmlrpc_client.ProtocolError as error:
555 # Catch authentication errors only.
556 if error.errcode != 403:
557 raise
558@@ -339,7 +339,7 @@ class TracLPPlugin(Trac):
559 self._internal_xmlrpc_transport = internal_xmlrpc_transport
560
561 xmlrpc_endpoint = urlappend(self.baseurl, 'xmlrpc')
562- self._server = xmlrpclib.ServerProxy(
563+ self._server = xmlrpc_client.ServerProxy(
564 xmlrpc_endpoint, transport=self._xmlrpc_transport)
565
566 def makeRequest(self, method, url, **kwargs):
567@@ -364,7 +364,7 @@ class TracLPPlugin(Trac):
568 @ensure_no_transaction
569 def _generateAuthenticationToken(self):
570 """Create an authentication token and return it."""
571- internal_xmlrpc = xmlrpclib.ServerProxy(
572+ internal_xmlrpc = xmlrpc_client.ServerProxy(
573 config.checkwatches.xmlrpc_url,
574 transport=self._internal_xmlrpc_transport)
575 return internal_xmlrpc.newBugTrackerToken()
576@@ -490,7 +490,7 @@ class TracLPPlugin(Trac):
577 try:
578 timestamp, lp_bug_id = self._server.launchpad.get_launchpad_bug(
579 remote_bug)
580- except xmlrpclib.Fault as fault:
581+ except xmlrpc_client.Fault as fault:
582 # Deal with "Ticket does not exist" faults. We re-raise
583 # anything else, since they're a sign of a bigger problem.
584 if fault.faultCode == FAULT_TICKET_NOT_FOUND:
585@@ -521,7 +521,7 @@ class TracLPPlugin(Trac):
586 try:
587 self._server.launchpad.set_launchpad_bug(
588 remote_bug, launchpad_bug_id)
589- except xmlrpclib.Fault as fault:
590+ except xmlrpc_client.Fault as fault:
591 # Deal with "Ticket does not exist" faults. We re-raise
592 # anything else, since they're a sign of a bigger problem.
593 if fault.faultCode == FAULT_TICKET_NOT_FOUND:
594diff --git a/lib/lp/bugs/externalbugtracker/xmlrpc.py b/lib/lp/bugs/externalbugtracker/xmlrpc.py
595index 6257d52..d82f03a 100644
596--- a/lib/lp/bugs/externalbugtracker/xmlrpc.py
597+++ b/lib/lp/bugs/externalbugtracker/xmlrpc.py
598@@ -10,10 +10,6 @@ __all__ = [
599
600
601 from io import BytesIO
602-from xmlrpclib import (
603- ProtocolError,
604- Transport,
605- )
606
607 from defusedxml.xmlrpc import monkey_patch
608 import requests
609@@ -23,6 +19,10 @@ from six.moves.urllib.parse import (
610 urlparse,
611 urlunparse,
612 )
613+from six.moves.xmlrpc_client import (
614+ ProtocolError,
615+ Transport,
616+ )
617
618 from lp.bugs.externalbugtracker.base import repost_on_redirect_hook
619 from lp.services.config import config
620diff --git a/lib/lp/bugs/scripts/checkwatches/core.py b/lib/lp/bugs/scripts/checkwatches/core.py
621index 5d47b6e..e3c41f6 100644
622--- a/lib/lp/bugs/scripts/checkwatches/core.py
623+++ b/lib/lp/bugs/scripts/checkwatches/core.py
624@@ -28,9 +28,9 @@ import socket
625 import sys
626 import threading
627 import time
628-from xmlrpclib import ProtocolError
629
630 import pytz
631+from six.moves.xmlrpc_client import ProtocolError
632 from twisted.internet import reactor
633 from twisted.internet.defer import DeferredList
634 from twisted.internet.threads import deferToThreadPool
635diff --git a/lib/lp/bugs/scripts/checkwatches/tests/test_core.py b/lib/lp/bugs/scripts/checkwatches/tests/test_core.py
636index f92f606..ba87699 100644
637--- a/lib/lp/bugs/scripts/checkwatches/tests/test_core.py
638+++ b/lib/lp/bugs/scripts/checkwatches/tests/test_core.py
639@@ -7,8 +7,8 @@ __metaclass__ = type
640 from datetime import datetime
641 import threading
642 import unittest
643-from xmlrpclib import ProtocolError
644
645+from six.moves.xmlrpc_client import ProtocolError
646 import transaction
647 from zope.component import getUtility
648
649diff --git a/lib/lp/bugs/scripts/checkwatches/utilities.py b/lib/lp/bugs/scripts/checkwatches/utilities.py
650index bd04094..ad149a2 100644
651--- a/lib/lp/bugs/scripts/checkwatches/utilities.py
652+++ b/lib/lp/bugs/scripts/checkwatches/utilities.py
653@@ -10,7 +10,8 @@ __all__ = [
654 ]
655
656 import socket
657-from xmlrpclib import ProtocolError
658+
659+from six.moves.xmlrpc_client import ProtocolError
660
661 from lp.bugs.externalbugtracker import (
662 BugNotFound,
663diff --git a/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt b/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt
664index 8586bc6..5474381 100644
665--- a/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt
666+++ b/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt
667@@ -4,9 +4,9 @@ Launchpad can generate LoginTokens which can then be used to
668 authenticate it with remote bug trackers. Generating these tokens is
669 done using the internal XML-RPC service.
670
671- >>> import xmlrpclib
672+ >>> from six.moves import xmlrpc_client
673 >>> from lp.testing.xmlrpc import XMLRPCTestTransport
674- >>> bugtracker_api = xmlrpclib.ServerProxy(
675+ >>> bugtracker_api = xmlrpc_client.ServerProxy(
676 ... 'http://xmlrpc-private.launchpad.test:8087/bugs',
677 ... transport=XMLRPCTestTransport())
678
679diff --git a/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt b/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt
680index b88517f..c2c0c45 100644
681--- a/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt
682+++ b/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt
683@@ -9,12 +9,12 @@ very similar to the TestBugzillaXMLRPCTransport, which it subclasses.
684 Only the parts of TestBugzillaAPIXMLRPCTransport that are different from
685 its ancestor will be tested here.
686
687- >>> import xmlrpclib
688+ >>> from six.moves import xmlrpc_client
689 >>> from lp.bugs.tests.externalbugtracker import (
690 ... TestBugzillaAPIXMLRPCTransport)
691 >>> bugzilla_transport = TestBugzillaAPIXMLRPCTransport(
692 ... 'http://example.com/xmlrpc.cgi')
693- >>> server = xmlrpclib.ServerProxy(
694+ >>> server = xmlrpc_client.ServerProxy(
695 ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport)
696
697
698diff --git a/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt b/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt
699index a90478a..078bad7 100644
700--- a/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt
701+++ b/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt
702@@ -4,12 +4,12 @@ TestBugzillaXMLRPCTransport
703 The TestBugzillaXMLRPCTransport is an XML-RPC transport which simulates
704 a remote Bugzilla instance that implements the Launchpad plugin API.
705
706- >>> import xmlrpclib
707+ >>> from six.moves import xmlrpc_client
708 >>> from lp.bugs.tests.externalbugtracker import (
709 ... TestBugzillaXMLRPCTransport)
710 >>> bugzilla_transport = TestBugzillaXMLRPCTransport(
711 ... 'http://example.com/xmlrpc.cgi')
712- >>> server = xmlrpclib.ServerProxy(
713+ >>> server = xmlrpc_client.ServerProxy(
714 ... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport)
715
716 The test transport will only allow calls to methods in a predefined set
717diff --git a/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt b/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt
718index f5c1d7c..4b9c6cb 100644
719--- a/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt
720+++ b/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt
721@@ -71,7 +71,7 @@ In addition to cookies sent by the server, we can set cookies locally.
722 foo=bar
723
724 If an error occurs trying to make the request, an
725-``xmlrpclib.ProtocolError`` is raised.
726+``xmlrpc_client.ProtocolError`` is raised.
727
728 >>> request_body = """<?xml version="1.0"?>
729 ... <methodCall>
730diff --git a/lib/lp/bugs/tests/externalbugtracker.py b/lib/lp/bugs/tests/externalbugtracker.py
731index 7802c56..b8a5b9d 100644
732--- a/lib/lp/bugs/tests/externalbugtracker.py
733+++ b/lib/lp/bugs/tests/externalbugtracker.py
734@@ -15,9 +15,9 @@ import os
735 import random
736 import re
737 import time
738-import xmlrpclib
739
740 import responses
741+from six.moves import xmlrpc_client
742 from six.moves.urllib_parse import (
743 parse_qs,
744 urljoin,
745@@ -564,7 +564,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
746 method on this class with the same name as the XML-RPC method is
747 called, with the extracted arguments passed on to it.
748 """
749- args, method_name = xmlrpclib.loads(request)
750+ args, method_name = xmlrpc_client.loads(request)
751 method_prefix, method_name = method_name.split('.')
752
753 assert method_prefix in self.methods, (
754@@ -579,7 +579,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
755 # cookie, throw a Fault.
756 if (method_name in self.auth_required_methods and
757 not self.has_valid_auth_cookie):
758- raise xmlrpclib.Fault(410, 'Login Required')
759+ raise xmlrpc_client.Fault(410, 'Login Required')
760
761 if self.print_method_calls:
762 if len(args) > 0:
763@@ -638,7 +638,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
764 self._setAuthCookie()
765
766 # We always return the same user ID.
767- # This has to be listified because xmlrpclib tries to expand
768+ # This has to be listified because xmlrpc_client tries to expand
769 # sequences of length 1.
770 return [{'user_id': 42}]
771
772@@ -762,7 +762,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
773
774 # If the bug doesn't exist, raise a fault.
775 if int(bug_id) not in self.bugs:
776- raise xmlrpclib.Fault(101, "Bug #%s does not exist." % bug_id)
777+ raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id)
778
779 # If we don't have comments for the bug already, create an empty
780 # comment dict.
781@@ -790,7 +790,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
782
783 self.comment_id_index = comment_id
784
785- # We have to return a list here because xmlrpclib will try to
786+ # We have to return a list here because xmlrpc_client will try to
787 # expand sequences of length 1. Trying to do that on a dict will
788 # cause it to explode.
789 return [{'comment_id': comment_id}]
790@@ -810,7 +810,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
791 old_launchpad_id = bug['internals'].get('launchpad_id', 0)
792 bug['internals']['launchpad_id'] = launchpad_id
793
794- # We need to return a list here because xmlrpclib will try to
795+ # We need to return a list here because xmlrpc_client will try to
796 # expand sequences of length 1, which will fail horribly when
797 # the sequence is in fact a dict.
798 return [{'launchpad_id': old_launchpad_id}]
799@@ -908,7 +908,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
800
801 def version(self):
802 """Return the version of Bugzilla being used."""
803- # This is to work around the old "xmlrpclib tries to expand
804+ # This is to work around the old "xmlrpc_client tries to expand
805 # sequences of length 1" problem (see above).
806 return [{'version': '3.4.1+'}]
807
808@@ -924,7 +924,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
809 self._setAuthCookie()
810 return [{'id': self.users.index(user)}]
811 else:
812- raise xmlrpclib.Fault(
813+ raise xmlrpc_client.Fault(
814 300,
815 "The username or password you entered is not valid.")
816
817@@ -1043,7 +1043,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
818
819 # If the bug doesn't exist, raise a fault.
820 if int(bug_id) not in self.bugs:
821- raise xmlrpclib.Fault(101, "Bug #%s does not exist." % bug_id)
822+ raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id)
823
824 # If we don't have comments for the bug already, create an empty
825 # comment dict.
826@@ -1072,7 +1072,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
827
828 self.comment_id_index = comment_id
829
830- # We have to return a list here because xmlrpclib will try to
831+ # We have to return a list here because xmlrpc_client will try to
832 # expand sequences of length 1. Trying to do that on a dict will
833 # cause it to explode.
834 return [{'id': comment_id}]
835@@ -1091,7 +1091,8 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
836
837 # If the bug ID doesn't exist, raise a Fault.
838 if bug_id not in self.bugs:
839- raise xmlrpclib.Fault(101, "Bug #%s does not exist." % bug_id)
840+ raise xmlrpc_client.Fault(
841+ 101, "Bug #%s does not exist." % bug_id)
842
843 see_also_list = self.bugs[bug_id].get('see_also', [])
844
845@@ -1121,7 +1122,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
846
847 if ('launchpad' not in url and
848 'show_bug.cgi' not in url):
849- raise xmlrpclib.Fault(
850+ raise xmlrpc_client.Fault(
851 112, "Bug URL %s is invalid." % url)
852
853 if changes.get(bug_id) is None:
854@@ -1139,7 +1140,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
855 # Replace the bug's existing see_also list.
856 self.bugs[bug_id]['see_also'] = see_also_list
857
858- # We have to return a list here because xmlrpclib will try to
859+ # We have to return a list here because xmlrpc_client will try to
860 # expand sequences of length 1. Trying to do that on a dict will
861 # cause it to explode.
862 return [{'changes': changes}]
863@@ -1266,7 +1267,7 @@ class TestInternalXMLRPCTransport:
864 self.quiet = quiet
865
866 def request(self, host, handler, request, verbose=None):
867- args, method_name = xmlrpclib.loads(request)
868+ args, method_name = xmlrpc_client.loads(request)
869 method = getattr(self, method_name)
870 with lp_dbuser():
871 return method(*args)
872@@ -1326,14 +1327,14 @@ class TestTracXMLRPCTransport(RequestsTransport):
873 """
874 assert handler.endswith('/xmlrpc'), (
875 'The Trac endpoint must end with /xmlrpc')
876- args, method_name = xmlrpclib.loads(request)
877+ args, method_name = xmlrpc_client.loads(request)
878 prefix = 'launchpad.'
879 assert method_name.startswith(prefix), (
880 'All methods should be in the launchpad namespace')
881 if (self.auth_cookie is None or
882 self.auth_cookie == self.expired_cookie):
883 # All the Trac XML-RPC methods need authentication.
884- raise xmlrpclib.ProtocolError(
885+ raise xmlrpc_client.ProtocolError(
886 method_name, errcode=403, errmsg="Forbidden",
887 headers=None)
888
889@@ -1520,7 +1521,7 @@ class TestTracXMLRPCTransport(RequestsTransport):
890 return 0. Otherwise return the mapped Launchpad bug ID.
891 """
892 if bugid not in self.remote_bugs:
893- raise xmlrpclib.Fault(
894+ raise xmlrpc_client.Fault(
895 FAULT_TICKET_NOT_FOUND, 'Ticket does not exist')
896
897 return [self.utc_time, self.launchpad_bugs.get(bugid, 0)]
898@@ -1534,12 +1535,12 @@ class TestTracXMLRPCTransport(RequestsTransport):
899 Return the current UTC timestamp.
900 """
901 if bugid not in self.remote_bugs:
902- raise xmlrpclib.Fault(
903+ raise xmlrpc_client.Fault(
904 FAULT_TICKET_NOT_FOUND, 'Ticket does not exist')
905
906 self.launchpad_bugs[bugid] = launchpad_bug
907
908- # Return a list, since xmlrpclib insists on trying to expand
909+ # Return a list, since xmlrpc_client insists on trying to expand
910 # results.
911 return [self.utc_time]
912
913@@ -1695,17 +1696,17 @@ class TestDebBugs(DebBugs):
914 def ensure_response_parser_is_expat(transport):
915 """Ensure the transport always selects the Expat-based response parser.
916
917- The response parser is chosen by xmlrpclib at runtime from a number of
918- choices, but the main Launchpad production environment selects Expat at
919- present.
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 Developer's machines could have other packages, `python-reportlab-accel`
925 (which provides the `sgmlop` module) for example, that cause different
926 response parsers to be chosen.
927 """
928 def getparser():
929- target = xmlrpclib.Unmarshaller(
930+ target = xmlrpc_client.Unmarshaller(
931 use_datetime=transport._use_datetime)
932- parser = xmlrpclib.ExpatParser(target)
933+ parser = xmlrpc_client.ExpatParser(target)
934 return parser, target
935 transport.getparser = getparser
936diff --git a/lib/lp/bugs/tests/trac-xmlrpc-transport.txt b/lib/lp/bugs/tests/trac-xmlrpc-transport.txt
937index cf64146..baa4880 100644
938--- a/lib/lp/bugs/tests/trac-xmlrpc-transport.txt
939+++ b/lib/lp/bugs/tests/trac-xmlrpc-transport.txt
940@@ -5,11 +5,11 @@ Trac plugin. It can be used to avoid network traffic while testing, and
941 it implements the same API that Trac instances having the LP plugin
942 installed implement.
943
944- >>> import xmlrpclib
945+ >>> from six.moves import xmlrpc_client
946 >>> from lp.bugs.tests.externalbugtracker import (
947 ... TestTracXMLRPCTransport)
948 >>> trac_transport = TestTracXMLRPCTransport('http://example.com/xmlrpc')
949- >>> server = xmlrpclib.ServerProxy(
950+ >>> server = xmlrpc_client.ServerProxy(
951 ... 'http://example.com/xmlrpc', transport=trac_transport)
952
953 All the methods need an authentication cookie to be sent.
954diff --git a/lib/lp/buildmaster/model/buildqueue.py b/lib/lp/buildmaster/model/buildqueue.py
955index fe9fad4..2af380a 100644
956--- a/lib/lp/buildmaster/model/buildqueue.py
957+++ b/lib/lp/buildmaster/model/buildqueue.py
958@@ -186,7 +186,7 @@ class BuildQueue(SQLBase):
959 if builder_status == "BuilderStatus.ABORTING":
960 self.logtail = "Waiting for slave process to be terminated"
961 elif slave_status.get("logtail") is not None:
962- # slave_status["logtail"] is normally an xmlrpclib.Binary
963+ # slave_status["logtail"] is normally an xmlrpc_client.Binary
964 # instance, and the contents might include invalid UTF-8 due to
965 # being a fixed number of bytes from the tail of the log. Turn
966 # it into Unicode as best we can.
967diff --git a/lib/lp/buildmaster/tests/mock_slaves.py b/lib/lp/buildmaster/tests/mock_slaves.py
968index 8b00c32..a19a85d 100644
969--- a/lib/lp/buildmaster/tests/mock_slaves.py
970+++ b/lib/lp/buildmaster/tests/mock_slaves.py
971@@ -24,10 +24,10 @@ __all__ = [
972 import os
973 import sys
974 import types
975-import xmlrpclib
976
977 import fixtures
978 from lpbuildd.tests.harness import BuilddSlaveTestSetup
979+from six.moves import xmlrpc_client
980 from testtools.content import Content
981 from testtools.content_type import UTF8_TEXT
982 from twisted.internet import defer
983@@ -159,7 +159,7 @@ class BuildingSlave(OkSlave):
984
985 def status(self):
986 self.call_log.append('status')
987- buildlog = xmlrpclib.Binary(
988+ buildlog = xmlrpc_client.Binary(
989 "This is a build log: %d" % self.status_count)
990 self.status_count += 1
991 return defer.succeed({
992@@ -231,7 +231,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 xmlrpclib.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@@ -246,7 +246,7 @@ class LostBuildingBrokenSlave:
1002
1003 def abort(self):
1004 self.call_log.append('abort')
1005- return defer.fail(xmlrpclib.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@@ -261,7 +261,7 @@ class BrokenSlave:
1011
1012 def status(self):
1013 self.call_log.append('status')
1014- return defer.fail(xmlrpclib.Fault(8001, "Broken slave"))
1015+ return defer.fail(xmlrpc_client.Fault(8001, "Broken slave"))
1016
1017
1018 class TrivialBehaviour:
1019diff --git a/lib/lp/buildmaster/tests/test_interactor.py b/lib/lp/buildmaster/tests/test_interactor.py
1020index 4327116..8514bb5 100644
1021--- a/lib/lp/buildmaster/tests/test_interactor.py
1022+++ b/lib/lp/buildmaster/tests/test_interactor.py
1023@@ -14,10 +14,10 @@ import hashlib
1024 import os
1025 import signal
1026 import tempfile
1027-import xmlrpclib
1028
1029 from lpbuildd.slave import BuilderStatus
1030 from lpbuildd.tests.harness import BuilddSlaveTestSetup
1031+from six.moves import xmlrpc_client
1032 from testtools.matchers import (
1033 ContainsAll,
1034 HasLength,
1035@@ -293,7 +293,7 @@ class TestBuilderInteractorCleanSlave(TestCase):
1036 try:
1037 yield BuilderInteractor.cleanSlave(
1038 vitals, slave, MockBuilderFactory(builder, None))
1039- except xmlrpclib.Fault:
1040+ except xmlrpc_client.Fault:
1041 self.assertEqual(['status', 'abort'], slave.call_log)
1042 else:
1043 self.fail("abort() should crash.")
1044@@ -327,7 +327,7 @@ class TestBuilderSlaveStatus(TestCase):
1045 del status["build_id"]
1046 if logtail:
1047 tail = status.pop("logtail")
1048- self.assertIsInstance(tail, xmlrpclib.Binary)
1049+ self.assertIsInstance(tail, xmlrpc_client.Binary)
1050
1051 self.assertEqual(expected, status)
1052
1053@@ -546,7 +546,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'], xmlrpclib.Binary)
1058+ self.assertIsInstance(status['logtail'], xmlrpc_client.Binary)
1059
1060 def test_ensurepresent_not_there(self):
1061 # ensurepresent checks to see if a file is there.
1062diff --git a/lib/lp/buildmaster/tests/test_manager.py b/lib/lp/buildmaster/tests/test_manager.py
1063index f645e25..491d2d5 100644
1064--- a/lib/lp/buildmaster/tests/test_manager.py
1065+++ b/lib/lp/buildmaster/tests/test_manager.py
1066@@ -12,8 +12,8 @@ from __future__ import absolute_import, print_function, unicode_literals
1067 import os
1068 import signal
1069 import time
1070-import xmlrpclib
1071
1072+from six.moves import xmlrpc_client
1073 from testtools.matchers import Equals
1074 from testtools.testcase import ExpectedException
1075 from testtools.twistedsupport import (
1076@@ -316,7 +316,7 @@ class TestSlaveScannerScan(TestCaseWithFactory):
1077 transaction.commit()
1078 scanner = self._getScanner(builder_name=builder.name)
1079 d = scanner.scan()
1080- return assert_fails_with(d, xmlrpclib.Fault)
1081+ return assert_fails_with(d, xmlrpc_client.Fault)
1082
1083 def test_scan_of_partial_utf8_logtail(self):
1084 # The builder returns a fixed number of bytes from the tail of the
1085@@ -325,7 +325,7 @@ class TestSlaveScannerScan(TestCaseWithFactory):
1086 @defer.inlineCallbacks
1087 def status(self):
1088 status = yield super(BrokenUTF8Slave, self).status()
1089- status["logtail"] = xmlrpclib.Binary(
1090+ status["logtail"] = xmlrpc_client.Binary(
1091 u"───".encode("UTF-8")[1:])
1092 defer.returnValue(status)
1093
1094@@ -354,7 +354,7 @@ class TestSlaveScannerScan(TestCaseWithFactory):
1095 @defer.inlineCallbacks
1096 def status(self):
1097 status = yield super(NULSlave, self).status()
1098- status["logtail"] = xmlrpclib.Binary(b"foo\0bar\0baz")
1099+ status["logtail"] = xmlrpc_client.Binary(b"foo\0bar\0baz")
1100 defer.returnValue(status)
1101
1102 builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
1103@@ -1087,7 +1087,7 @@ class TestCancellationChecking(TestCaseWithFactory):
1104 slave = LostBuildingBrokenSlave()
1105 self.builder.current_build.cancel()
1106 with ExpectedException(
1107- xmlrpclib.Fault, "<Fault 8002: u'Could not abort'>"):
1108+ xmlrpc_client.Fault, "<Fault 8002: u'Could not abort'>"):
1109 yield self._getScanner().checkCancellation(self.vitals, slave)
1110
1111
1112diff --git a/lib/lp/code/doc/branch-xmlrpc.txt b/lib/lp/code/doc/branch-xmlrpc.txt
1113index dc6b227..e7da5ad 100644
1114--- a/lib/lp/code/doc/branch-xmlrpc.txt
1115+++ b/lib/lp/code/doc/branch-xmlrpc.txt
1116@@ -1,7 +1,7 @@
1117 IPublicCodehostingAPI
1118 =====================
1119
1120- >>> import xmlrpclib
1121+ >>> from six.moves import xmlrpc_client
1122 >>> from lp.testing.xmlrpc import XMLRPCTestTransport
1123
1124
1125@@ -17,7 +17,7 @@ Bazaar is strictly unsupported.
1126 This API is deprecated, and will eventually be replaced with an
1127 equivalent method in the new Launchpad API infrastructure.
1128
1129- >>> public_codehosting_api = xmlrpclib.ServerProxy(
1130+ >>> public_codehosting_api = xmlrpc_client.ServerProxy(
1131 ... 'http://xmlrpc.launchpad.test/bazaar/',
1132 ... transport=XMLRPCTestTransport())
1133
1134diff --git a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
1135index e4bb535..0b6404d 100644
1136--- a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
1137+++ b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
1138@@ -42,9 +42,9 @@ can be found in the tests for ICodeImportJobSet.
1139
1140 The point of all this is for it to be accessed over XMLRPC.
1141
1142- >>> import xmlrpclib
1143+ >>> from six.moves import xmlrpc_client
1144 >>> from lp.testing.xmlrpc import XMLRPCTestTransport
1145- >>> codeimportscheduler = xmlrpclib.ServerProxy(
1146+ >>> codeimportscheduler = xmlrpc_client.ServerProxy(
1147 ... 'http://xmlrpc-private.launchpad.test:8087/codeimportscheduler',
1148 ... transport=XMLRPCTestTransport())
1149 >>> codeimportscheduler.getJobForMachine('bazaar-importer', 2)
1150diff --git a/lib/lp/code/xmlrpc/branch.py b/lib/lp/code/xmlrpc/branch.py
1151index bd45c11..d15a335 100644
1152--- a/lib/lp/code/xmlrpc/branch.py
1153+++ b/lib/lp/code/xmlrpc/branch.py
1154@@ -10,7 +10,7 @@ __all__ = [
1155 ]
1156
1157
1158-from xmlrpclib import Fault
1159+from six.moves.xmlrpc_client import Fault
1160
1161 from breezy import urlutils
1162 from zope.component import getUtility
1163diff --git a/lib/lp/code/xmlrpc/tests/test_branch.py b/lib/lp/code/xmlrpc/tests/test_branch.py
1164index d035177..2affa3a 100644
1165--- a/lib/lp/code/xmlrpc/tests/test_branch.py
1166+++ b/lib/lp/code/xmlrpc/tests/test_branch.py
1167@@ -6,10 +6,10 @@
1168 __metaclass__ = type
1169
1170 import os
1171-import xmlrpclib
1172
1173 from breezy import urlutils
1174 from lazr.uri import URI
1175+from six.moves import xmlrpc_client
1176 from zope.security.proxy import removeSecurityProxy
1177
1178 from lp.app.enums import InformationType
1179@@ -81,7 +81,7 @@ class TestExpandURL(TestCaseWithFactory):
1180 api = PublicCodehostingAPI(None, None)
1181 fault = api.resolve_lp_path(lp_url_path)
1182 self.assertTrue(
1183- isinstance(fault, xmlrpclib.Fault),
1184+ isinstance(fault, xmlrpc_client.Fault),
1185 "resolve_lp_path(%r) returned %r, not a Fault."
1186 % (lp_url_path, fault))
1187 self.assertEqual(expected_fault.__class__, fault.__class__)
1188diff --git a/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py b/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py
1189index e2b8d7a..60ad9ce 100644
1190--- a/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py
1191+++ b/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py
1192@@ -5,8 +5,7 @@
1193
1194 __metaclass__ = type
1195
1196-import xmlrpclib
1197-
1198+from six.moves import xmlrpc_client
1199 from zope.component import getUtility
1200 from zope.security.proxy import removeSecurityProxy
1201
1202@@ -77,7 +76,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
1203 # is no code import job with the given ID.
1204 fault = self.api.getImportDataForJobID(-1)
1205 self.assertTrue(
1206- isinstance(fault, xmlrpclib.Fault),
1207+ isinstance(fault, xmlrpc_client.Fault),
1208 "getImportDataForJobID(-1) returned %r, not a Fault."
1209 % (fault,))
1210 self.assertEqual(NoSuchCodeImportJob, fault.__class__)
1211@@ -96,7 +95,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
1212 # code import job with the given ID.
1213 fault = self.api.updateHeartbeat(-1, '')
1214 self.assertTrue(
1215- isinstance(fault, xmlrpclib.Fault),
1216+ isinstance(fault, xmlrpc_client.Fault),
1217 "updateHeartbeat(-1, '') returned %r, not a Fault."
1218 % (fault,))
1219 self.assertEqual(NoSuchCodeImportJob, fault.__class__)
1220@@ -131,7 +130,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
1221 fault = self.api.finishJobID(
1222 -1, CodeImportResultStatus.SUCCESS.name, '')
1223 self.assertTrue(
1224- isinstance(fault, xmlrpclib.Fault),
1225+ isinstance(fault, xmlrpc_client.Fault),
1226 "finishJobID(-1, 'SUCCESS', 0) returned %r, not a Fault."
1227 % (fault,))
1228 self.assertEqual(NoSuchCodeImportJob, fault.__class__)
1229diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
1230index 2873314..a2a7103 100644
1231--- a/lib/lp/codehosting/inmemory.py
1232+++ b/lib/lp/codehosting/inmemory.py
1233@@ -10,7 +10,7 @@ __all__ = [
1234 ]
1235
1236 import operator
1237-from xmlrpclib import Fault
1238+from six.moves.xmlrpc_client import Fault
1239
1240 from breezy.urlutils import (
1241 escape,
1242diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py
1243index 23ee03e..38cb7e9 100644
1244--- a/lib/lp/codehosting/tests/test_acceptance.py
1245+++ b/lib/lp/codehosting/tests/test_acceptance.py
1246@@ -11,13 +11,13 @@ import signal
1247 import subprocess
1248 import sys
1249 import time
1250-import xmlrpclib
1251
1252 import breezy.branch
1253 from breezy.tests import TestCaseWithTransport
1254 from breezy.tests.per_repository import all_repository_format_scenarios
1255 from breezy.urlutils import local_path_from_url
1256 from breezy.workingtree import WorkingTree
1257+from six.moves import xmlrpc_client
1258 from six.moves.urllib.request import urlopen
1259 from testscenarios import (
1260 load_tests_apply_scenarios,
1261@@ -318,9 +318,9 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
1262 Used to create branches that the test user is not able to create, and
1263 might not even be able to view.
1264 """
1265- authserver = xmlrpclib.ServerProxy(
1266+ authserver = xmlrpc_client.ServerProxy(
1267 config.codehosting.authentication_endpoint)
1268- codehosting_api = xmlrpclib.ServerProxy(
1269+ codehosting_api = xmlrpc_client.ServerProxy(
1270 config.codehosting.codehosting_endpoint)
1271 if creator is None:
1272 creator_id = authserver.getUserAndSSHKeys(user)['id']
1273diff --git a/lib/lp/codehosting/vfs/branchfs.py b/lib/lp/codehosting/vfs/branchfs.py
1274index 92d4b3f..c984771 100644
1275--- a/lib/lp/codehosting/vfs/branchfs.py
1276+++ b/lib/lp/codehosting/vfs/branchfs.py
1277@@ -56,7 +56,6 @@ __all__ = [
1278
1279 import os.path
1280 import sys
1281-import xmlrpclib
1282
1283 from breezy import urlutils
1284 from breezy.bzr.bzrdir import BzrDir
1285@@ -72,6 +71,7 @@ from breezy.transport import get_transport
1286 from breezy.transport.memory import MemoryServer
1287 from lazr.uri import URI
1288 import six
1289+from six.moves import xmlrpc_client
1290 from twisted.internet import (
1291 defer,
1292 error,
1293@@ -171,7 +171,7 @@ def is_lock_directory(absolute_path):
1294
1295 def get_ro_server():
1296 """Get a Launchpad internal server for scanning branches."""
1297- proxy = xmlrpclib.ServerProxy(config.codehosting.codehosting_endpoint)
1298+ proxy = xmlrpc_client.ServerProxy(config.codehosting.codehosting_endpoint)
1299 codehosting_endpoint = DeferredBlockingProxy(proxy)
1300 branch_transport = get_readonly_transport(
1301 get_transport(config.codehosting.internal_branch_by_id_root))
1302@@ -194,7 +194,8 @@ def get_rw_server(direct_database=False):
1303 if direct_database:
1304 return DirectDatabaseLaunchpadServer('lp-internal:///', transport)
1305 else:
1306- proxy = xmlrpclib.ServerProxy(config.codehosting.codehosting_endpoint)
1307+ proxy = xmlrpc_client.ServerProxy(
1308+ config.codehosting.codehosting_endpoint)
1309 codehosting_endpoint = DeferredBlockingProxy(proxy)
1310 return LaunchpadInternalServer(
1311 'lp-internal:///', codehosting_endpoint, transport)
1312@@ -749,7 +750,7 @@ def get_lp_server(user_id, codehosting_endpoint_url=None, branch_url=None,
1313 raise AssertionError(
1314 "can't supply both branch_url and branch_transport!")
1315
1316- codehosting_client = xmlrpclib.ServerProxy(codehosting_endpoint_url)
1317+ codehosting_client = xmlrpc_client.ServerProxy(codehosting_endpoint_url)
1318 lp_server = LaunchpadServer(
1319 DeferredBlockingProxy(codehosting_client), user_id, branch_transport,
1320 seen_new_branch_hook)
1321diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py
1322index eba8732..0aa7fe7 100644
1323--- a/lib/lp/codehosting/vfs/tests/test_branchfs.py
1324+++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py
1325@@ -10,7 +10,6 @@ import os
1326 import re
1327 from StringIO import StringIO
1328 import sys
1329-import xmlrpclib
1330
1331 from breezy import errors
1332 from breezy.bzr.bzrdir import BzrDir
1333@@ -36,6 +35,7 @@ from breezy.urlutils import (
1334 escape,
1335 local_path_to_url,
1336 )
1337+from six.moves import xmlrpc_client
1338 from testtools.twistedsupport import (
1339 assert_fails_with,
1340 AsynchronousDeferredRunTest,
1341@@ -1037,7 +1037,7 @@ class TestBranchChangedErrorHandling(TestCaseWithTransport, TestCase):
1342 report = errorlog.globalErrorUtility.raising(f, request)
1343 # Record the id for checking later.
1344 self.generated_oopsids.append(report['id'])
1345- raise xmlrpclib.Fault(-1, report)
1346+ raise xmlrpc_client.Fault(-1, report)
1347
1348 def get_server(self):
1349 if self._server is None:
1350diff --git a/lib/lp/registry/tests/mailinglists_helper.py b/lib/lp/registry/tests/mailinglists_helper.py
1351index 4a51736..bb7942a 100644
1352--- a/lib/lp/registry/tests/mailinglists_helper.py
1353+++ b/lib/lp/registry/tests/mailinglists_helper.py
1354@@ -11,9 +11,7 @@ __all__ = [
1355 'new_team',
1356 ]
1357
1358-
1359-import xmlrpclib
1360-
1361+from six.moves import xmlrpc_client
1362 from zope.component import getUtility
1363
1364 from lp.registry.enums import TeamMembershipPolicy
1365@@ -39,7 +37,7 @@ def fault_catcher(func):
1366
1367 def caller(self, *args, **kws):
1368 result = func(self, *args, **kws)
1369- if isinstance(result, xmlrpclib.Fault):
1370+ if isinstance(result, xmlrpc_client.Fault):
1371 raise result
1372 else:
1373 return result
1374diff --git a/lib/lp/registry/tests/test_mailinglistapi.py b/lib/lp/registry/tests/test_mailinglistapi.py
1375index 8b90ce2..e967e3e 100644
1376--- a/lib/lp/registry/tests/test_mailinglistapi.py
1377+++ b/lib/lp/registry/tests/test_mailinglistapi.py
1378@@ -8,13 +8,13 @@ __all__ = []
1379
1380 from email import message_from_string
1381 from textwrap import dedent
1382-import xmlrpclib
1383
1384 from testtools.matchers import (
1385 Equals,
1386 MatchesDict,
1387 MatchesSetwise,
1388 )
1389+from six.moves import xmlrpc_client
1390 import transaction
1391 from zope.component import getUtility
1392 from zope.security.proxy import removeSecurityProxy
1393@@ -496,7 +496,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory):
1394 I put \xa9 in the body.
1395 """))
1396 info = self.mailinglist_api.holdMessage(
1397- 'team', xmlrpclib.Binary(message.as_string()))
1398+ 'team', xmlrpc_client.Binary(message.as_string()))
1399 transaction.commit()
1400 found = self.message_approval_set.getMessageByMessageID('<\\xa9-me>')
1401 self.assertIs(True, info)
1402diff --git a/lib/lp/registry/tests/test_xmlrpc.py b/lib/lp/registry/tests/test_xmlrpc.py
1403index 1223cc3..5217f8c 100644
1404--- a/lib/lp/registry/tests/test_xmlrpc.py
1405+++ b/lib/lp/registry/tests/test_xmlrpc.py
1406@@ -5,8 +5,7 @@
1407
1408 __metaclass__ = type
1409
1410-import xmlrpclib
1411-
1412+from six.moves import xmlrpc_client
1413 from zope.security.proxy import removeSecurityProxy
1414
1415 from lp.registry.enums import PersonVisibility
1416@@ -21,7 +20,7 @@ class TestCanonicalSSOApplication(TestCaseWithFactory):
1417
1418 def setUp(self):
1419 super(TestCanonicalSSOApplication, self).setUp()
1420- self.rpc_proxy = xmlrpclib.ServerProxy(
1421+ self.rpc_proxy = xmlrpc_client.ServerProxy(
1422 'http://xmlrpc-private.launchpad.test:8087/canonicalsso',
1423 transport=XMLRPCTestTransport())
1424
1425@@ -50,12 +49,12 @@ class TestCanonicalSSOApplication(TestCaseWithFactory):
1426 person = self.factory.makePerson()
1427 openid_identifier = removeSecurityProxy(
1428 person.account).openid_identifiers.any().identifier
1429- public_rpc_proxy = xmlrpclib.ServerProxy(
1430+ public_rpc_proxy = xmlrpc_client.ServerProxy(
1431 'http://test@canonical.com:test@'
1432 'xmlrpc.launchpad.test/canonicalsso',
1433 transport=XMLRPCTestTransport())
1434 e = self.assertRaises(
1435- xmlrpclib.ProtocolError,
1436+ xmlrpc_client.ProtocolError,
1437 public_rpc_proxy.getPersonDetailsByOpenIDIdentifier,
1438 openid_identifier)
1439 self.assertEqual(404, e.errcode)
1440diff --git a/lib/lp/registry/xmlrpc/mailinglist.py b/lib/lp/registry/xmlrpc/mailinglist.py
1441index a8545db..9a16123 100644
1442--- a/lib/lp/registry/xmlrpc/mailinglist.py
1443+++ b/lib/lp/registry/xmlrpc/mailinglist.py
1444@@ -9,8 +9,8 @@ __all__ = [
1445 ]
1446
1447 import re
1448-import xmlrpclib
1449
1450+from six.moves import xmlrpc_client
1451 from zope.component import getUtility
1452 from zope.interface import implementer
1453 from zope.security.proxy import removeSecurityProxy
1454@@ -241,7 +241,7 @@ class MailingListAPIView(LaunchpadXMLRPCView):
1455 # non-ascii characters in the message can be safely passed across
1456 # XMLRPC. For most tests though it's much more convenient to just
1457 # pass 8-bit strings.
1458- if isinstance(bytes, xmlrpclib.Binary):
1459+ if isinstance(bytes, xmlrpc_client.Binary):
1460 bytes = bytes.data
1461 # Although it is illegal for an email header to have unencoded
1462 # non-ascii characters, it is better to let the list owner
1463diff --git a/lib/lp/services/authserver/doc/xmlrpc-authserver.txt b/lib/lp/services/authserver/doc/xmlrpc-authserver.txt
1464index 95b44c0..7918087 100644
1465--- a/lib/lp/services/authserver/doc/xmlrpc-authserver.txt
1466+++ b/lib/lp/services/authserver/doc/xmlrpc-authserver.txt
1467@@ -28,9 +28,9 @@ The AuthServerAPIView provides the IAuthServer XML-RPC API:
1468 That interface allows the codehosting SSH server to find information
1469 about users.
1470
1471- >>> import xmlrpclib
1472+ >>> from six.moves import xmlrpc_client
1473 >>> from lp.testing.xmlrpc import XMLRPCTestTransport
1474- >>> authserver= xmlrpclib.ServerProxy(
1475+ >>> authserver= xmlrpc_client.ServerProxy(
1476 ... 'http://xmlrpc-private.launchpad.test:8087/authserver',
1477 ... transport=XMLRPCTestTransport())
1478
1479diff --git a/lib/lp/services/features/__init__.py b/lib/lp/services/features/__init__.py
1480index 08fbeca..0c44375 100644
1481--- a/lib/lp/services/features/__init__.py
1482+++ b/lib/lp/services/features/__init__.py
1483@@ -131,7 +131,7 @@ Checking flags without access to the database
1484 Feature flags can also be checked without access to the database by making use
1485 of the 'getFeatureFlag' XML-RPC method.
1486
1487- server_proxy = xmlrpclib.ServerProxy(
1488+ server_proxy = xmlrpc_client.ServerProxy(
1489 config.launchpad.feature_flags_endpoint, allow_none=True)
1490 if server_proxy.getFeatureFlag(
1491 'codehosting.use_forking_server', ['user:' + user_name]):
1492diff --git a/lib/lp/services/features/tests/test_xmlrpc.py b/lib/lp/services/features/tests/test_xmlrpc.py
1493index 2e7b46c..9f72825 100644
1494--- a/lib/lp/services/features/tests/test_xmlrpc.py
1495+++ b/lib/lp/services/features/tests/test_xmlrpc.py
1496@@ -5,7 +5,7 @@
1497
1498 __metaclass__ = type
1499
1500-import xmlrpclib
1501+from six.moves import xmlrpc_client
1502
1503 from lp.services import features
1504 from lp.services.config import config
1505@@ -84,13 +84,13 @@ class TestGetFeatureFlag(TestCaseWithFactory):
1506 flag_name, ['user:' + person.name]))
1507
1508 def test_xmlrpc_interface_unset(self):
1509- sp = xmlrpclib.ServerProxy(
1510+ sp = xmlrpc_client.ServerProxy(
1511 config.launchpad.feature_flags_endpoint,
1512 transport=XMLRPCTestTransport(), allow_none=True)
1513 self.assertEqual(None, sp.getFeatureFlag(u'flag'))
1514
1515 def test_xmlrpc_interface_set(self):
1516- sp = xmlrpclib.ServerProxy(
1517+ sp = xmlrpc_client.ServerProxy(
1518 config.launchpad.feature_flags_endpoint,
1519 transport=XMLRPCTestTransport(), allow_none=True)
1520 flag_name = u'flag'
1521diff --git a/lib/lp/services/tests/test_timeout.py b/lib/lp/services/tests/test_timeout.py
1522index f811945..33cdcdf 100644
1523--- a/lib/lp/services/tests/test_timeout.py
1524+++ b/lib/lp/services/tests/test_timeout.py
1525@@ -13,7 +13,6 @@ from SimpleXMLRPCServer import (
1526 import socket
1527 from textwrap import dedent
1528 import threading
1529-import xmlrpclib
1530
1531 from fixtures import (
1532 MonkeyPatch,
1533@@ -24,6 +23,7 @@ from requests.exceptions import (
1534 ConnectionError,
1535 InvalidSchema,
1536 )
1537+from six.moves import xmlrpc_client
1538 from testtools.matchers import (
1539 ContainsDict,
1540 Equals,
1541@@ -500,8 +500,8 @@ class TestTimeout(TestCase):
1542 logRequests=False)
1543 server_thread = threading.Thread(target=server.serve_2_requests)
1544 server_thread.start()
1545- proxy = xmlrpclib.ServerProxy(http_server_url,
1546- transport=TransportWithTimeout())
1547+ proxy = xmlrpc_client.ServerProxy(
1548+ http_server_url, transport=TransportWithTimeout())
1549 self.assertEqual('Successful test message.',
1550 proxy.echo('Successful test message.'))
1551 self.assertRaises(TimeoutError,
1552diff --git a/lib/lp/services/tests/test_xmlrpc.py b/lib/lp/services/tests/test_xmlrpc.py
1553index bd75959..2d624b3 100644
1554--- a/lib/lp/services/tests/test_xmlrpc.py
1555+++ b/lib/lp/services/tests/test_xmlrpc.py
1556@@ -13,7 +13,7 @@ from lp.testing.layers import BaseLayer
1557
1558
1559 class TestTransport(TestCase):
1560- """Test code that allows xmlrpclib.ServerProxy to have a socket timeout"""
1561+ """Test code that allows ServerProxy to have a socket timeout."""
1562
1563 layer = BaseLayer
1564
1565diff --git a/lib/lp/services/timeout.py b/lib/lp/services/timeout.py
1566index d96456f..c06a703 100644
1567--- a/lib/lp/services/timeout.py
1568+++ b/lib/lp/services/timeout.py
1569@@ -26,10 +26,6 @@ from threading import (
1570 Lock,
1571 Thread,
1572 )
1573-from xmlrpclib import (
1574- SafeTransport,
1575- Transport,
1576- )
1577
1578 from requests import (
1579 HTTPError,
1580@@ -42,6 +38,10 @@ from requests.adapters import (
1581 from requests_file import FileAdapter
1582 from requests_toolbelt.downloadutils import stream
1583 from six import reraise
1584+from six.moves.xmlrpc_client import (
1585+ SafeTransport,
1586+ Transport,
1587+ )
1588 from urllib3.connectionpool import (
1589 HTTPConnectionPool,
1590 HTTPSConnectionPool,
1591diff --git a/lib/lp/services/twistedsupport/xmlrpc.py b/lib/lp/services/twistedsupport/xmlrpc.py
1592index 13f82c5..3521641 100644
1593--- a/lib/lp/services/twistedsupport/xmlrpc.py
1594+++ b/lib/lp/services/twistedsupport/xmlrpc.py
1595@@ -17,7 +17,7 @@ from twisted.web import xmlrpc
1596
1597
1598 class BlockingProxy:
1599- """Make an xmlrpclib.ServerProxy behave like a Twisted XML-RPC proxy.
1600+ """Make a ServerProxy behave like a Twisted XML-RPC proxy.
1601
1602 This is useful for writing code that needs to work in both a synchronous
1603 and asynchronous fashion.
1604@@ -29,7 +29,7 @@ class BlockingProxy:
1605 def __init__(self, proxy):
1606 """Construct a `BlockingProxy`.
1607
1608- :param proxy: An xmlrpclib.ServerProxy.
1609+ :param proxy: An xmlrpc_client.ServerProxy.
1610 """
1611 self._proxy = proxy
1612
1613@@ -38,12 +38,13 @@ class BlockingProxy:
1614
1615
1616 class DeferredBlockingProxy(BlockingProxy):
1617- """Make an xmlrpclib.ServerProxy behave more like a Twisted XML-RPC proxy.
1618+ """Make a ServerProxy behave more like a Twisted XML-RPC proxy.
1619
1620 This is almost exactly like 'BlockingProxy', except that this returns
1621 Deferreds. It is guaranteed to be exactly as synchronous as the passed-in
1622- proxy. That means if you pass in a normal xmlrpclib proxy you ought to be
1623- able to use `lp.services.twistedsupport.extract_result` to get the result.
1624+ proxy. That means if you pass in a normal xmlrpc_client proxy you ought to
1625+ be able to use `lp.services.twistedsupport.extract_result` to get the
1626+ result.
1627 """
1628
1629 def callRemote(self, method_name, *args, **kwargs):
1630diff --git a/lib/lp/services/webapp/servers.py b/lib/lp/services/webapp/servers.py
1631index e99fb05..33cf173 100644
1632--- a/lib/lp/services/webapp/servers.py
1633+++ b/lib/lp/services/webapp/servers.py
1634@@ -6,7 +6,6 @@
1635 __metaclass__ = type
1636
1637 import threading
1638-import xmlrpclib
1639
1640 from lazr.restful.interfaces import (
1641 ICollectionResource,
1642@@ -20,6 +19,7 @@ from lazr.restful.publisher import (
1643 from lazr.restful.utils import get_current_browser_request
1644 from lazr.uri import URI
1645 import six
1646+from six.moves import xmlrpc_client
1647 from six.moves.urllib.parse import parse_qs
1648 import transaction
1649 from transaction.interfaces import ISynchronizer
1650@@ -1443,15 +1443,15 @@ class PublicXMLRPCResponse(XMLRPCResponse):
1651 """Response type for doing public XML-RPC in Launchpad."""
1652
1653 def handleException(self, exc_info):
1654- # If we don't have a proper xmlrpclib.Fault, and we have
1655+ # If we don't have a proper xmlrpc_client.Fault, and we have
1656 # logged an OOPS, create a Fault that reports the OOPS ID to
1657 # the user.
1658 exc_value = exc_info[1]
1659- if not isinstance(exc_value, xmlrpclib.Fault):
1660+ if not isinstance(exc_value, xmlrpc_client.Fault):
1661 request = get_current_browser_request()
1662 if request is not None and request.oopsid is not None:
1663- exc_info = (xmlrpclib.Fault,
1664- xmlrpclib.Fault(-1, request.oopsid),
1665+ exc_info = (xmlrpc_client.Fault,
1666+ xmlrpc_client.Fault(-1, request.oopsid),
1667 None)
1668 XMLRPCResponse.handleException(self, exc_info)
1669
1670diff --git a/lib/lp/services/xmlrpc.py b/lib/lp/services/xmlrpc.py
1671index dde6103..9eff891 100644
1672--- a/lib/lp/services/xmlrpc.py
1673+++ b/lib/lp/services/xmlrpc.py
1674@@ -10,15 +10,15 @@ __all__ = [
1675 ]
1676
1677 import socket
1678-import xmlrpclib
1679
1680 from defusedxml.xmlrpc import monkey_patch
1681+from six.moves import xmlrpc_client
1682
1683 # Protect against various XML parsing vulnerabilities.
1684 monkey_patch()
1685
1686
1687-class LaunchpadFault(xmlrpclib.Fault):
1688+class LaunchpadFault(xmlrpc_client.Fault):
1689 """Base class for a Launchpad XMLRPC fault.
1690
1691 Subclasses should define a unique error_code and a msg_template,
1692@@ -34,7 +34,7 @@ class LaunchpadFault(xmlrpclib.Fault):
1693 assert self.msg_template is not None, (
1694 "Subclasses must define msg_template.")
1695 msg = self.msg_template % kw
1696- xmlrpclib.Fault.__init__(self, self.error_code, msg)
1697+ xmlrpc_client.Fault.__init__(self, self.error_code, msg)
1698
1699 def __eq__(self, other):
1700 if not isinstance(other, LaunchpadFault):
1701@@ -47,19 +47,19 @@ class LaunchpadFault(xmlrpclib.Fault):
1702 return not (self == other)
1703
1704
1705-class Transport(xmlrpclib.Transport):
1706- """An xmlrpclib transport that supports a timeout argument.
1707+class Transport(xmlrpc_client.Transport):
1708+ """An xmlrpc_client transport that supports a timeout argument.
1709
1710- Use by passing into the "transport" argument of the xmlrpclib.ServerProxy
1711- initialization.
1712+ Use by passing into the "transport" argument of the
1713+ xmlrpc_client.ServerProxy initialization.
1714 """
1715
1716 def __init__(self,
1717 use_datetime=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
1718- xmlrpclib.Transport.__init__(self, use_datetime)
1719+ xmlrpc_client.Transport.__init__(self, use_datetime)
1720 self.timeout = timeout
1721
1722 def make_connection(self, host):
1723- conn = xmlrpclib.Transport.make_connection(self, host)
1724+ conn = xmlrpc_client.Transport.make_connection(self, host)
1725 conn.timeout = self.timeout
1726 return conn
1727diff --git a/lib/lp/soyuz/model/livefsbuildbehaviour.py b/lib/lp/soyuz/model/livefsbuildbehaviour.py
1728index bef72b0..4182c79 100644
1729--- a/lib/lp/soyuz/model/livefsbuildbehaviour.py
1730+++ b/lib/lp/soyuz/model/livefsbuildbehaviour.py
1731@@ -87,7 +87,7 @@ class LiveFSBuildBehaviour(BuildFarmJobBehaviourBase):
1732 base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs(
1733 logger=logger)
1734 # Non-trivial metadata values may have been security-wrapped, which
1735- # is pointless here and just gets in the way of xmlrpclib
1736+ # is pointless here and just gets in the way of xmlrpc_client
1737 # serialisation.
1738 args = dict(removeSecurityProxy(build.livefs.metadata))
1739 if build.metadata_override is not None:
1740diff --git a/lib/lp/testing/xmlrpc.py b/lib/lp/testing/xmlrpc.py
1741index 50a78c5..066297e 100644
1742--- a/lib/lp/testing/xmlrpc.py
1743+++ b/lib/lp/testing/xmlrpc.py
1744@@ -8,9 +8,11 @@ __all__ = [
1745 ]
1746
1747 from cStringIO import StringIO
1748-import xmlrpclib
1749
1750-from six.moves import http_client
1751+from six.moves import (
1752+ http_client,
1753+ xmlrpc_client,
1754+ )
1755 from zope.security.management import (
1756 endInteraction,
1757 queryInteraction,
1758@@ -38,7 +40,7 @@ class _FakeSocket(object):
1759 class TestHTTPConnection(http_client.HTTPConnection):
1760 """A HTTPConnection which talks to http() instead of a real server.
1761
1762- Only the methods called by xmlrpclib are overridden.
1763+ Only the methods called by xmlrpc_client are overridden.
1764 """
1765
1766 _data_to_send = ''
1767@@ -76,7 +78,7 @@ class TestHTTPConnection(http_client.HTTPConnection):
1768 return response
1769
1770
1771-class XMLRPCTestTransport(xmlrpclib.Transport):
1772+class XMLRPCTestTransport(xmlrpc_client.Transport):
1773 """An XMLRPC Transport which sends the requests to http()."""
1774
1775 def make_connection(self, host):
1776diff --git a/lib/lp/xmlrpc/application.py b/lib/lp/xmlrpc/application.py
1777index 0bd91b6..a84706b 100644
1778--- a/lib/lp/xmlrpc/application.py
1779+++ b/lib/lp/xmlrpc/application.py
1780@@ -11,8 +11,7 @@ __all__ = [
1781 'SelfTest',
1782 ]
1783
1784-import xmlrpclib
1785-
1786+from six.moves import xmlrpc_client
1787 from zope.component import getUtility
1788 from zope.interface import (
1789 implementer,
1790@@ -101,7 +100,7 @@ class SelfTest(LaunchpadXMLRPCView):
1791
1792 def make_fault(self):
1793 """Returns an xmlrpc fault."""
1794- return xmlrpclib.Fault(666, "Yoghurt and spanners.")
1795+ return xmlrpc_client.Fault(666, "Yoghurt and spanners.")
1796
1797 def concatenate(self, string1, string2):
1798 """Return the concatenation of the two given strings."""
1799diff --git a/lib/lp/xmlrpc/configure.zcml b/lib/lp/xmlrpc/configure.zcml
1800index 70e4bb6..47a3100 100644
1801--- a/lib/lp/xmlrpc/configure.zcml
1802+++ b/lib/lp/xmlrpc/configure.zcml
1803@@ -74,148 +74,148 @@
1804 />
1805
1806 <class class="lp.xmlrpc.faults.BranchAlreadyRegistered">
1807- <require like_class="xmlrpclib.Fault" />
1808+ <require like_class="six.moves.xmlrpc_client.Fault" />
1809 </class>
1810
1811 <class class="lp.xmlrpc.faults.FileBugGotProductAndDistro">
1812- <require like_class="xmlrpclib.Fault" />
1813+ <require like_class="six.moves.xmlrpc_client.Fault" />
1814 </class>
1815
1816 <class
1817 class="lp.xmlrpc.faults.FileBugMissingProductOrDistribution"
1818 >
1819- <require like_class="xmlrpclib.Fault" />
1820+ <require like_class="six.moves.xmlrpc_client.Fault" />
1821 </class>
1822
1823 <class class="lp.xmlrpc.faults.NoSuchDistribution">
1824- <require like_class="xmlrpclib.Fault" />
1825+ <require like_class="six.moves.xmlrpc_client.Fault" />
1826 </class>
1827
1828 <class class="lp.xmlrpc.faults.NoSuchPackage">
1829- <require like_class="xmlrpclib.Fault" />
1830+ <require like_class="six.moves.xmlrpc_client.Fault" />
1831 </class>
1832
1833 <class class="lp.xmlrpc.faults.NoSuchProduct">
1834- <require like_class="xmlrpclib.Fault" />
1835+ <require like_class="six.moves.xmlrpc_client.Fault" />
1836 </class>
1837
1838 <class class="lp.xmlrpc.faults.NoSuchPerson">
1839- <require like_class="xmlrpclib.Fault" />
1840+ <require like_class="six.moves.xmlrpc_client.Fault" />
1841 </class>
1842
1843 <class class="lp.xmlrpc.faults.NoSuchPersonWithName">
1844- <require like_class="xmlrpclib.Fault" />
1845+ <require like_class="six.moves.xmlrpc_client.Fault" />
1846 </class>
1847
1848 <class class="lp.xmlrpc.faults.NoSuchBranch">
1849- <require like_class="xmlrpclib.Fault" />
1850+ <require like_class="six.moves.xmlrpc_client.Fault" />
1851 </class>
1852
1853 <class class="lp.xmlrpc.faults.NoSuchBug">
1854- <require like_class="xmlrpclib.Fault" />
1855+ <require like_class="six.moves.xmlrpc_client.Fault" />
1856 </class>
1857
1858 <class class="lp.xmlrpc.faults.RequiredParameterMissing">
1859- <require like_class="xmlrpclib.Fault" />
1860+ <require like_class="six.moves.xmlrpc_client.Fault" />
1861 </class>
1862
1863 <class class="lp.xmlrpc.faults.BranchCreationForbidden">
1864- <require like_class="xmlrpclib.Fault" />
1865+ <require like_class="six.moves.xmlrpc_client.Fault" />
1866 </class>
1867
1868 <class class="lp.xmlrpc.faults.InvalidBranchUrl">
1869- <require like_class="xmlrpclib.Fault" />
1870+ <require like_class="six.moves.xmlrpc_client.Fault" />
1871 </class>
1872
1873 <class class="lp.xmlrpc.faults.BranchUniqueNameConflict">
1874- <require like_class="xmlrpclib.Fault" />
1875+ <require like_class="six.moves.xmlrpc_client.Fault" />
1876 </class>
1877
1878 <class class="lp.xmlrpc.faults.NoSuchTeamMailingList">
1879- <require like_class="xmlrpclib.Fault" />
1880+ <require like_class="six.moves.xmlrpc_client.Fault" />
1881 </class>
1882
1883 <class class="lp.xmlrpc.faults.UnexpectedStatusReport">
1884- <require like_class="xmlrpclib.Fault" />
1885+ <require like_class="six.moves.xmlrpc_client.Fault" />
1886 </class>
1887
1888 <class class="lp.xmlrpc.faults.BadStatus">
1889- <require like_class="xmlrpclib.Fault" />
1890+ <require like_class="six.moves.xmlrpc_client.Fault" />
1891 </class>
1892
1893 <class class="lp.xmlrpc.faults.NoLinkedBranch">
1894- <require like_class="xmlrpclib.Fault" />
1895+ <require like_class="six.moves.xmlrpc_client.Fault" />
1896 </class>
1897
1898 <class class="lp.xmlrpc.faults.NoSuchProductSeries">
1899- <require like_class="xmlrpclib.Fault" />
1900+ <require like_class="six.moves.xmlrpc_client.Fault" />
1901 </class>
1902
1903 <class class="lp.xmlrpc.faults.InvalidBranchIdentifier">
1904- <require like_class="xmlrpclib.Fault" />
1905+ <require like_class="six.moves.xmlrpc_client.Fault" />
1906 </class>
1907
1908 <class class="lp.xmlrpc.faults.BranchNameInUse">
1909- <require like_class="xmlrpclib.Fault" />
1910+ <require like_class="six.moves.xmlrpc_client.Fault" />
1911 </class>
1912
1913 <class class="lp.xmlrpc.faults.CannotHaveLinkedBranch">
1914- <require like_class="xmlrpclib.Fault" />
1915+ <require like_class="six.moves.xmlrpc_client.Fault" />
1916 </class>
1917
1918 <class class="lp.xmlrpc.faults.InvalidProductName">
1919- <require like_class="xmlrpclib.Fault" />
1920+ <require like_class="six.moves.xmlrpc_client.Fault" />
1921 </class>
1922
1923 <class class="lp.xmlrpc.faults.NotInTeam">
1924- <require like_class="xmlrpclib.Fault" />
1925+ <require like_class="six.moves.xmlrpc_client.Fault" />
1926 </class>
1927
1928 <class class="lp.xmlrpc.faults.InvalidBranchName">
1929- <require like_class="xmlrpclib.Fault" />
1930+ <require like_class="six.moves.xmlrpc_client.Fault" />
1931 </class>
1932
1933 <class class="lp.xmlrpc.faults.NoBranchWithID">
1934- <require like_class="xmlrpclib.Fault" />
1935+ <require like_class="six.moves.xmlrpc_client.Fault" />
1936 </class>
1937
1938 <class class="lp.xmlrpc.faults.NoUrlForBranch">
1939- <require like_class="xmlrpclib.Fault" />
1940+ <require like_class="six.moves.xmlrpc_client.Fault" />
1941 </class>
1942
1943 <class class="lp.xmlrpc.faults.PathTranslationError">
1944- <require like_class="xmlrpclib.Fault" />
1945+ <require like_class="six.moves.xmlrpc_client.Fault" />
1946 </class>
1947
1948 <class class="lp.xmlrpc.faults.InvalidPath">
1949- <require like_class="xmlrpclib.Fault" />
1950+ <require like_class="six.moves.xmlrpc_client.Fault" />
1951 </class>
1952
1953 <class class="lp.xmlrpc.faults.PermissionDenied">
1954- <require like_class="xmlrpclib.Fault" />
1955+ <require like_class="six.moves.xmlrpc_client.Fault" />
1956 </class>
1957
1958 <class class="lp.xmlrpc.faults.NotFound">
1959- <require like_class="xmlrpclib.Fault" />
1960+ <require like_class="six.moves.xmlrpc_client.Fault" />
1961 </class>
1962
1963 <class class="lp.xmlrpc.faults.InvalidBranchUniqueName">
1964- <require like_class="xmlrpclib.Fault" />
1965+ <require like_class="six.moves.xmlrpc_client.Fault" />
1966 </class>
1967
1968 <class class="lp.xmlrpc.faults.NoSuchDistroSeries">
1969- <require like_class="xmlrpclib.Fault" />
1970+ <require like_class="six.moves.xmlrpc_client.Fault" />
1971 </class>
1972
1973 <class class="lp.xmlrpc.faults.NoSuchSourcePackageName">
1974- <require like_class="xmlrpclib.Fault" />
1975+ <require like_class="six.moves.xmlrpc_client.Fault" />
1976 </class>
1977
1978 <class class="lp.xmlrpc.faults.InvalidSourcePackageName">
1979- <require like_class="xmlrpclib.Fault" />
1980+ <require like_class="six.moves.xmlrpc_client.Fault" />
1981 </class>
1982
1983 <class class="lp.xmlrpc.faults.Unauthorized">
1984- <require like_class="xmlrpclib.Fault" />
1985+ <require like_class="six.moves.xmlrpc_client.Fault" />
1986 </class>
1987 </configure>
1988diff --git a/lib/lp/xmlrpc/helpers.py b/lib/lp/xmlrpc/helpers.py
1989index d4d3cc4..194468f 100644
1990--- a/lib/lp/xmlrpc/helpers.py
1991+++ b/lib/lp/xmlrpc/helpers.py
1992@@ -8,8 +8,7 @@ __all__ = [
1993 'return_fault',
1994 ]
1995
1996-from xmlrpclib import Fault
1997-
1998+from six.moves.xmlrpc_client import Fault
1999 from twisted.python.util import mergeFunctionMetadata
2000
2001
2002diff --git a/lib/lp/xmlrpc/tests/test_private_xmlrpc.py b/lib/lp/xmlrpc/tests/test_private_xmlrpc.py
2003index ed5fe51..c20d180 100644
2004--- a/lib/lp/xmlrpc/tests/test_private_xmlrpc.py
2005+++ b/lib/lp/xmlrpc/tests/test_private_xmlrpc.py
2006@@ -4,8 +4,7 @@
2007 """Private XMLRPC tests.
2008 """
2009
2010-import xmlrpclib
2011-
2012+from six.moves import xmlrpc_client
2013 from zope.component import getUtility
2014
2015 from lp.services.verification.interfaces.logintoken import ILoginTokenSet
2016@@ -31,14 +30,14 @@ class TestPrivateXMLRPC(TestCase):
2017 private_root = 'http://xmlrpc-private.launchpad.test:8087/'
2018
2019 def get_public_proxy(self, path):
2020- """Get an xmlrpclib.ServerProxy pointing at the public URL"""
2021- return xmlrpclib.ServerProxy(
2022+ """Get an xmlrpc_client.ServerProxy pointing at the public URL"""
2023+ return xmlrpc_client.ServerProxy(
2024 self.public_root + path,
2025 transport=XMLRPCTestTransport())
2026
2027 def get_private_proxy(self, path):
2028- """Get an xmlrpclib.ServerProxy pointing at the private URL"""
2029- return xmlrpclib.ServerProxy(
2030+ """Get an xmlrpc_client.ServerProxy pointing at the private URL"""
2031+ return xmlrpc_client.ServerProxy(
2032 self.private_root + path,
2033 transport=XMLRPCTestTransport())
2034
2035@@ -48,7 +47,7 @@ class TestPrivateXMLRPC(TestCase):
2036 not available on the external XML-RPC port.
2037 """
2038 external_api = self.get_public_proxy('mailinglists/')
2039- e = self.assertRaises(xmlrpclib.ProtocolError,
2040+ e = self.assertRaises(xmlrpc_client.ProtocolError,
2041 external_api.getPendingActions)
2042 self.assertEqual(404, e.errcode)
2043
2044@@ -78,7 +77,7 @@ class TestPrivateXMLRPC(TestCase):
2045 internal_api = self.get_private_proxy('bugs/')
2046 bug_dict = dict(
2047 product='firefox', summary='the summary', comment='the comment')
2048- e = self.assertRaises(xmlrpclib.ProtocolError,
2049+ e = self.assertRaises(xmlrpc_client.ProtocolError,
2050 internal_api.filebug, bug_dict)
2051 self.assertEqual(404, e.errcode)
2052
2053diff --git a/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py b/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py
2054index 313fe1e..4c005eb 100644
2055--- a/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py
2056+++ b/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py
2057@@ -4,8 +4,7 @@
2058 """XMLRPC self-test api.
2059 """
2060
2061-import xmlrpclib
2062-
2063+from six.moves import xmlrpc_client
2064 from zope.component import getUtility
2065
2066 from lp.services.webapp.interfaces import ILaunchBag
2067@@ -28,11 +27,11 @@ class TestXMLRPCSelfTest(TestCaseWithFactory):
2068 layer = LaunchpadFunctionalLayer
2069
2070 def make_proxy(self):
2071- return xmlrpclib.ServerProxy(
2072+ return xmlrpc_client.ServerProxy(
2073 'http://xmlrpc.launchpad.test/', transport=XMLRPCTestTransport())
2074
2075 def make_logged_in_proxy(self):
2076- return xmlrpclib.ServerProxy(
2077+ return xmlrpc_client.ServerProxy(
2078 'http://test@canonical.com:test@xmlrpc.launchpad.test/',
2079 transport=XMLRPCTestTransport())
2080
2081@@ -47,18 +46,18 @@ class TestXMLRPCSelfTest(TestCaseWithFactory):
2082 self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault))
2083
2084 def test_custom_transport(self):
2085- """We can test our XMLRPC APIs using xmlrpclib, using a custom
2086+ """We can test our XMLRPC APIs using xmlrpc_client, using a custom
2087 Transport which talks with the publisher directly.
2088 """
2089 selftest = self.make_proxy()
2090 self.assertEqual('foo bar', selftest.concatenate('foo', 'bar'))
2091- fault = self.assertRaises(xmlrpclib.Fault, selftest.make_fault)
2092+ fault = self.assertRaises(xmlrpc_client.Fault, selftest.make_fault)
2093 self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault))
2094
2095 def test_unexpected_exception(self):
2096 """Sometimes an XML-RPC method will be buggy, and raise an exception
2097- other than xmlrpclib.Fault. We have such a method on the self test
2098- view.
2099+ other than xmlrpc_client.Fault. We have such a method on the self
2100+ test view.
2101 """
2102 selftestview = SelfTest('somecontext', 'somerequest')
2103 self.assertRaises(RuntimeError, selftestview.raise_exception)
2104@@ -70,7 +69,7 @@ class TestXMLRPCSelfTest(TestCaseWithFactory):
2105 one was generated):
2106 """
2107 selftest = self.make_proxy()
2108- e = self.assertRaises(xmlrpclib.Fault, selftest.raise_exception)
2109+ e = self.assertRaises(xmlrpc_client.Fault, selftest.raise_exception)
2110 self.assertStartsWith(str(e), "<Fault -1: 'OOPS-")
2111
2112 def test_anonymous_authentication(self):

Subscribers

People subscribed via source and target branches