launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27659
[Merge] ~cjwatson/launchpad:xmlrpc-client into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:xmlrpc-client into launchpad:master.
Commit message:
Import xmlrpc.client directly
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/411270
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:xmlrpc-client into launchpad:master.
diff --git a/lib/launchpad_loggerhead/app.py b/lib/launchpad_loggerhead/app.py
index cf7e1e7..aa58d54 100644
--- a/lib/launchpad_loggerhead/app.py
+++ b/lib/launchpad_loggerhead/app.py
@@ -4,6 +4,7 @@
import logging
import os
import threading
+import xmlrpc.client
from breezy import (
errors,
@@ -40,7 +41,6 @@ from paste.request import (
path_info_pop,
)
import six
-from six.moves import xmlrpc_client
from six.moves.urllib.parse import (
urlencode,
urljoin,
@@ -72,7 +72,7 @@ thread_locals = threading.local()
def check_fault(fault, *fault_classes):
"""Check if 'fault's faultCode matches any of 'fault_classes'.
- :param fault: An instance of `xmlrpc_client.Fault`.
+ :param fault: An instance of `xmlrpc.client.Fault`.
:param fault_classes: Any number of `LaunchpadFault` subclasses.
"""
for cls in fault_classes:
@@ -98,7 +98,7 @@ class RootApp:
def get_branchfs(self):
t = getattr(thread_locals, 'branchfs', None)
if t is None:
- thread_locals.branchfs = xmlrpc_client.ServerProxy(
+ thread_locals.branchfs = xmlrpc.client.ServerProxy(
config.codehosting.codehosting_endpoint)
return thread_locals.branchfs
@@ -221,7 +221,7 @@ class RootApp:
branchfs = self.get_branchfs()
transport_type, info, trail = branchfs.translatePath(
identity_url, urlutils.escape(path))
- except xmlrpc_client.Fault as f:
+ except xmlrpc.client.Fault as f:
if check_fault(f, faults.PathTranslationError):
raise HTTPNotFound()
elif check_fault(f, faults.PermissionDenied):
diff --git a/lib/lp/app/stories/basics/xx-opstats.txt b/lib/lp/app/stories/basics/xx-opstats.txt
index 1539c53..09a1389 100644
--- a/lib/lp/app/stories/basics/xx-opstats.txt
+++ b/lib/lp/app/stories/basics/xx-opstats.txt
@@ -4,9 +4,9 @@ Operational Statistics and Metrics
We make Zope 3 give us real time statistics about Launchpad's operation.
We can access them via XML-RPC:
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.testing.xmlrpc import XMLRPCTestTransport
- >>> lp_xmlrpc = xmlrpc_client.ServerProxy(
+ >>> lp_xmlrpc = xmlrpc.client.ServerProxy(
... 'http://xmlrpc.launchpad.test/+opstats',
... transport=XMLRPCTestTransport()
... )
@@ -192,7 +192,7 @@ Number of XML-RPC Faults
... try:
... opstats = lp_xmlrpc.invalid() # XXX: Need a HTTP test too
... print('Should have raised a Fault exception!')
- ... except xmlrpc_client.Fault:
+ ... except xmlrpc.client.Fault:
... pass
>>> report()
requests: 1
diff --git a/lib/lp/bugs/doc/bugtracker-tokens.txt b/lib/lp/bugs/doc/bugtracker-tokens.txt
index a32f050..0d5d6e8 100644
--- a/lib/lp/bugs/doc/bugtracker-tokens.txt
+++ b/lib/lp/bugs/doc/bugtracker-tokens.txt
@@ -3,12 +3,12 @@ Using BugTracker Login Tokens
Launchpad offers an XML-RPC interface for generating bug tracker tokens.
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from zope.component import getUtility
>>> from lp.testing.xmlrpc import XMLRPCTestTransport
>>> from lp.services.verification.interfaces.logintoken import (
... ILoginTokenSet)
- >>> bugtracker_api = xmlrpc_client.ServerProxy(
+ >>> bugtracker_api = xmlrpc.client.ServerProxy(
... 'http://xmlrpc-private.launchpad.test:8087/bugs',
... transport=XMLRPCTestTransport())
diff --git a/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt b/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt
index 218e38d..579ba33 100644
--- a/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt
+++ b/lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt
@@ -130,7 +130,7 @@ login_required() and will retry the method call.
If authentication fails, a BugTrackerAuthenticationError will be raised.
- >>> from six.moves.xmlrpc_client import Fault, ProtocolError
+ >>> from xmlrpc.client import Fault, ProtocolError
>>> class TestAuthFailingBugzillaXMLRPCTransport(
... ZopelessBugzillaXMLRPCTransport):
... error = Fault(100, "Sorry, you can't log in.")
diff --git a/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt b/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt
index d04257a..7ecb403 100644
--- a/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt
+++ b/lib/lp/bugs/doc/externalbugtracker-bugzilla.txt
@@ -86,25 +86,25 @@ ExternalBugTracker will be returned.
The Bugzilla ExternalBugTracker has a _test_xmlrpc_proxy property which
we override for the purpose of this test.
- >>> from six.moves import xmlrpc_client
- >>> class FailingXMLRPCTransport(xmlrpc_client.Transport):
+ >>> import xmlrpc.client
+ >>> class FailingXMLRPCTransport(xmlrpc.client.Transport):
...
- ... error = xmlrpc_client.Fault(
- ... xmlrpc_client.METHOD_NOT_FOUND, "Method doesn't exist")
+ ... error = xmlrpc.client.Fault(
+ ... xmlrpc.client.METHOD_NOT_FOUND, "Method doesn't exist")
...
... def request(self, host, handler, request, verbose=None):
... if self.error is not None:
... raise self.error
... else:
... # We need to return something here, otherwise
- ... # xmlrpc_client will explode.
+ ... # xmlrpc.client will explode.
... return '0.42-test'
...
>>> test_transport = FailingXMLRPCTransport()
>>> class BugzillaWithFakeProxy(Bugzilla):
...
- ... _test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ ... _test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi', transport=test_transport)
>>> bugzilla = BugzillaWithFakeProxy('http://example.com')
@@ -129,7 +129,7 @@ BugzillaAPI instance.
The same is true if getExternalBugTrackerToUse() receives a 404 error
from the remote server.
- >>> test_transport.error = xmlrpc_client.ProtocolError(
+ >>> test_transport.error = xmlrpc.client.ProtocolError(
... 'http://example.com/xmlrpc.cgi', 404, 'Not Found', None)
>>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse()
@@ -141,7 +141,7 @@ from the remote server.
Some Bugzillas respond to an invalid XML-RPC method call by returning a
500 error. getExternalBugTrackerToUse() handles those, too.
- >>> test_transport.error = xmlrpc_client.ProtocolError(
+ >>> test_transport.error = xmlrpc.client.ProtocolError(
... 'http://example.com/xmlrpc.cgi', 500, 'Server Error', None)
>>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse()
@@ -153,7 +153,7 @@ Some Bugzillas respond to an invalid XML-RPC method call by returning a
Some other Bugzillas generate an unparsable response, causing
ResponseError to be raised.
- >>> test_transport.error = xmlrpc_client.ResponseError()
+ >>> test_transport.error = xmlrpc.client.ResponseError()
>>> bugzilla_to_use = bugzilla.getExternalBugTrackerToUse()
>>> (isinstance(bugzilla_to_use, Bugzilla) and
@@ -164,22 +164,22 @@ If the remote Bugzilla offers the Bugzilla 3.4 API, an instance of
BuzillaAPI will be returned. To test this, we use a specially-crafted
XML-RPC proxy that behaves like a Bugzilla 3.4 instance.
- >>> class APIXMLRPCTransport(xmlrpc_client.Transport):
+ >>> class APIXMLRPCTransport(xmlrpc.client.Transport):
...
... version = '3.4.2'
...
... def request(self, host, handler, request, verbose=None):
- ... args, method_name = xmlrpc_client.loads(request)
+ ... args, method_name = xmlrpc.client.loads(request)
...
... if method_name == 'Bugzilla.version':
... return [{'version': self.version}]
... else:
- ... raise xmlrpc_client.Fault(
- ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method')
+ ... raise xmlrpc.client.Fault(
+ ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method')
...
>>> test_transport = APIXMLRPCTransport()
- >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi',
... transport=test_transport)
@@ -193,7 +193,7 @@ A version older than 3.4 is not accepted.
>>> test_transport = APIXMLRPCTransport()
>>> test_transport.version = '3.3'
- >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi',
... transport=test_transport)
@@ -206,7 +206,7 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted.
>>> test_transport = APIXMLRPCTransport()
>>> test_transport.version = '20181108.1'
- >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi',
... transport=test_transport)
@@ -218,20 +218,20 @@ bugzilla.mozilla.org uses a date-based version scheme. This is accepted.
If the remote system has the Launchpad plugin installed, an
getExternalBugTrackerToUse() will return a BugzillaLPPlugin instance.
- >>> class PluginXMLRPCTransport(xmlrpc_client.Transport):
+ >>> class PluginXMLRPCTransport(xmlrpc.client.Transport):
...
... def request(self, host, handler, request, verbose=None):
- ... args, method_name = xmlrpc_client.loads(request)
+ ... args, method_name = xmlrpc.client.loads(request)
...
... if method_name == 'Launchpad.plugin_version':
... return [{'version': '0.2'}]
... else:
- ... raise xmlrpc_client.Fault(
- ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method')
+ ... raise xmlrpc.client.Fault(
+ ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method')
...
>>> test_transport = PluginXMLRPCTransport()
- >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi',
... transport=test_transport)
@@ -244,19 +244,19 @@ in response to XML-RPC calls. When something other than a mapping is
returned, the standard non-API non-plugin external bug tracker is
selected.
- >>> class OldXMLRPCTransport(xmlrpc_client.Transport):
+ >>> class OldXMLRPCTransport(xmlrpc.client.Transport):
... def request(self, host, handler, request, verbose=None):
- ... args, method_name = xmlrpc_client.loads(request)
+ ... args, method_name = xmlrpc.client.loads(request)
...
... if method_name == 'Bugzilla.version':
... return ('versionResponse', {'version': '3.2.5+'})
... else:
- ... raise xmlrpc_client.Fault(
- ... xmlrpc_client.METHOD_NOT_FOUND, 'No such method')
+ ... raise xmlrpc.client.Fault(
+ ... xmlrpc.client.METHOD_NOT_FOUND, 'No such method')
...
>>> test_transport = OldXMLRPCTransport()
- >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi',
... transport=test_transport)
@@ -270,18 +270,18 @@ is not discovered over XML-RPC. It's not clear if this is an error in
Bugzilla or in and XML-RPC library used by Bugzilla. In any case, we
recognize and treat it the same as METHOD_NOT_FOUND.
- >>> class OldBrokenXMLRPCTransport(xmlrpc_client.Transport):
+ >>> class OldBrokenXMLRPCTransport(xmlrpc.client.Transport):
... def request(self, host, handler, request, verbose=None):
- ... args, method_name = xmlrpc_client.loads(request)
+ ... args, method_name = xmlrpc.client.loads(request)
...
... if method_name == 'Bugzilla.version':
... return ('versionResponse', {'version': '3.2.5+'})
... else:
- ... raise xmlrpc_client.Fault('Client', 'No such method')
+ ... raise xmlrpc.client.Fault('Client', 'No such method')
...
>>> test_transport = OldBrokenXMLRPCTransport()
- >>> bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ >>> bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi',
... transport=test_transport)
diff --git a/lib/lp/bugs/doc/malone-xmlrpc.txt b/lib/lp/bugs/doc/malone-xmlrpc.txt
index 0be732d..4b5ee05 100644
--- a/lib/lp/bugs/doc/malone-xmlrpc.txt
+++ b/lib/lp/bugs/doc/malone-xmlrpc.txt
@@ -3,9 +3,9 @@ XML-RPC Integration with Malone
Malone provides an XML-RPC interface for filing bugs.
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.testing.xmlrpc import XMLRPCTestTransport
- >>> filebug_api = xmlrpc_client.ServerProxy(
+ >>> filebug_api = xmlrpc.client.ServerProxy(
... 'http://test@xxxxxxxxxxxxx:test@xxxxxxxxxxxxxxxxxxxxx/bugs/',
... transport=XMLRPCTestTransport())
@@ -278,7 +278,7 @@ The LoginToken generated will be of the LoginTokenType BUGTRACKER.
These requests are all handled by the private xml-rpc server.
- >>> bugtracker_api = xmlrpc_client.ServerProxy(
+ >>> bugtracker_api = xmlrpc.client.ServerProxy(
... 'http://xmlrpc-private.launchpad.test:8087/bugs',
... transport=XMLRPCTestTransport())
diff --git a/lib/lp/bugs/externalbugtracker/bugzilla.py b/lib/lp/bugs/externalbugtracker/bugzilla.py
index 5269ebc..7a84697 100644
--- a/lib/lp/bugs/externalbugtracker/bugzilla.py
+++ b/lib/lp/bugs/externalbugtracker/bugzilla.py
@@ -14,12 +14,12 @@ from email.utils import parseaddr
from http.client import BadStatusLine
import re
import xml.parsers.expat
+import xmlrpc.client
from defusedxml import minidom
import pytz
import requests
import six
-from six.moves import xmlrpc_client
from zope.component import getUtility
from zope.interface import (
alsoProvides,
@@ -90,15 +90,15 @@ class Bugzilla(ExternalBugTracker):
# We try calling Bugzilla.version() on the remote
# server because it's the most lightweight method there is.
remote_version = proxy.Bugzilla.version()
- except xmlrpc_client.Fault as fault:
+ except xmlrpc.client.Fault as fault:
# 'Client' is a hangover. Either Bugzilla or the Perl
# XML-RPC lib in use returned it as faultCode. It's wrong,
# but it's known wrongness, so we recognize it here.
- if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'):
+ if fault.faultCode in (xmlrpc.client.METHOD_NOT_FOUND, 'Client'):
return False
else:
raise
- except xmlrpc_client.ProtocolError as error:
+ except xmlrpc.client.ProtocolError as error:
# We catch 404s, which occur when xmlrpc.cgi doesn't exist
# on the remote server, and 500s, which sometimes occur when
# an invalid request is made to the remote server. We allow
@@ -107,7 +107,7 @@ class Bugzilla(ExternalBugTracker):
return False
else:
raise
- except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError):
+ except (xmlrpc.client.ResponseError, xml.parsers.expat.ExpatError):
# The server returned an unparsable response.
return False
else:
@@ -132,15 +132,15 @@ class Bugzilla(ExternalBugTracker):
# We try calling Launchpad.plugin_version() on the remote
# server because it's the most lightweight method there is.
proxy.Launchpad.plugin_version()
- except xmlrpc_client.Fault as fault:
+ except xmlrpc.client.Fault as fault:
# 'Client' is a hangover. Either Bugzilla or the Perl
# XML-RPC lib in use returned it as faultCode. It's wrong,
# but it's known wrongness, so we recognize it here.
- if fault.faultCode in (xmlrpc_client.METHOD_NOT_FOUND, 'Client'):
+ if fault.faultCode in (xmlrpc.client.METHOD_NOT_FOUND, 'Client'):
return False
else:
raise
- except xmlrpc_client.ProtocolError as error:
+ except xmlrpc.client.ProtocolError as error:
# We catch 404s, which occur when xmlrpc.cgi doesn't exist
# on the remote server, and 500s, which sometimes occur when
# the Launchpad Plugin isn't installed. Everything else we
@@ -150,7 +150,7 @@ class Bugzilla(ExternalBugTracker):
return False
else:
raise
- except (xmlrpc_client.ResponseError, xml.parsers.expat.ExpatError):
+ except (xmlrpc.client.ResponseError, xml.parsers.expat.ExpatError):
# The server returned an unparsable response.
return False
else:
@@ -169,7 +169,7 @@ class Bugzilla(ExternalBugTracker):
return BugzillaLPPlugin(self.baseurl)
elif self._remoteSystemHasBugzillaAPI():
return BugzillaAPI(self.baseurl)
- except (xmlrpc_client.ProtocolError, requests.RequestException,
+ except (xmlrpc.client.ProtocolError, requests.RequestException,
BadStatusLine):
pass
return self
@@ -538,14 +538,14 @@ class Bugzilla(ExternalBugTracker):
def needs_authentication(func):
"""Decorator for automatically authenticating if needed.
- If an `xmlrpc_client.Fault` with error code 410 is raised by the
+ If an `xmlrpc.client.Fault` with error code 410 is raised by the
function, we'll try to authenticate and call the function again.
"""
def decorator(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
- except xmlrpc_client.Fault as fault:
+ except xmlrpc.client.Fault as fault:
# Catch authentication errors only.
if fault.faultCode != 410:
raise
@@ -587,8 +587,8 @@ class BugzillaAPI(Bugzilla):
@property
def xmlrpc_proxy(self):
- """Return an `xmlrpc_client.ServerProxy` to self.xmlrpc_endpoint."""
- return xmlrpc_client.ServerProxy(
+ """Return an `xmlrpc.client.ServerProxy` to self.xmlrpc_endpoint."""
+ return xmlrpc.client.ServerProxy(
self.xmlrpc_endpoint, transport=self.xmlrpc_transport)
@property
@@ -622,7 +622,7 @@ class BugzillaAPI(Bugzilla):
"""
try:
self.xmlrpc_proxy.User.login(self.credentials)
- except xmlrpc_client.Fault as fault:
+ except xmlrpc.client.Fault as fault:
raise BugTrackerAuthenticationError(
self.baseurl,
"Fault %s: %s" % (fault.faultCode, fault.faultString))
@@ -972,7 +972,7 @@ class BugzillaLPPlugin(BugzillaAPI):
Bugzilla_logincookie, which we can then use to re-authenticate
ourselves for each subsequent method call.
"""
- internal_xmlrpc_server = xmlrpc_client.ServerProxy(
+ internal_xmlrpc_server = xmlrpc.client.ServerProxy(
config.checkwatches.xmlrpc_url,
transport=self.internal_xmlrpc_transport)
@@ -981,12 +981,12 @@ class BugzillaLPPlugin(BugzillaAPI):
try:
self.xmlrpc_proxy.Launchpad.login(
{'token': token_text})
- except xmlrpc_client.Fault as fault:
+ except xmlrpc.client.Fault as fault:
message = 'XML-RPC Fault: %s "%s"' % (
fault.faultCode, fault.faultString)
raise BugTrackerAuthenticationError(
self.baseurl, message)
- except xmlrpc_client.ProtocolError as error:
+ except xmlrpc.client.ProtocolError as error:
message = 'Protocol error: %s "%s"' % (
error.errcode, error.errmsg)
raise BugTrackerAuthenticationError(
diff --git a/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py b/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py
index 2b8ea61..05bca65 100644
--- a/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py
+++ b/lib/lp/bugs/externalbugtracker/tests/test_bugzilla.py
@@ -4,9 +4,9 @@
"""Tests for the Bugzilla BugTracker."""
from xml.parsers.expat import ExpatError
+import xmlrpc.client
import responses
-from six.moves import xmlrpc_client
import transaction
from lp.bugs.externalbugtracker.base import UnparsableBugData
@@ -71,11 +71,11 @@ class TestBugzillaSniffing(TestCase):
# it is taken to mean that no XML-RPC capabilities exist.
bugzilla = Bugzilla("http://not.real")
- class Transport(xmlrpc_client.Transport):
+ class Transport(xmlrpc.client.Transport):
def request(self, host, handler, request, verbose=None):
raise ExpatError("mismatched tag")
- bugzilla._test_xmlrpc_proxy = xmlrpc_client.ServerProxy(
+ bugzilla._test_xmlrpc_proxy = xmlrpc.client.ServerProxy(
'%s/xmlrpc.cgi' % bugzilla.baseurl, transport=Transport())
# We must abort any existing transactions before attempting to call
diff --git a/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py b/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py
index b23cbe5..c473f34 100644
--- a/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py
+++ b/lib/lp/bugs/externalbugtracker/tests/test_xmlrpc.py
@@ -20,7 +20,7 @@ class TestRequestsTransport(TestCase):
@responses.activate
def test_expat_error(self):
- # Malformed XML-RPC responses cause xmlrpc_client to raise an
+ # Malformed XML-RPC responses cause xmlrpc.client to raise an
# ExpatError.
responses.add(
"POST", "http://www.example.com/xmlrpc",
@@ -28,7 +28,7 @@ class TestRequestsTransport(TestCase):
transport = RequestsTransport("http://not.real/")
# The Launchpad production environment selects Expat at present. This
- # is quite strict compared to the other parsers that xmlrpc_client
+ # is quite strict compared to the other parsers that xmlrpc.client
# can possibly select.
ensure_response_parser_is_expat(transport)
diff --git a/lib/lp/bugs/externalbugtracker/trac.py b/lib/lp/bugs/externalbugtracker/trac.py
index 9a2e0a3..9d67e1f 100644
--- a/lib/lp/bugs/externalbugtracker/trac.py
+++ b/lib/lp/bugs/externalbugtracker/trac.py
@@ -10,11 +10,11 @@ import csv
from datetime import datetime
from email.utils import parseaddr
import time
+import xmlrpc.client
import pytz
import requests
from requests.cookies import RequestsCookieJar
-from six.moves import xmlrpc_client
from zope.component import getUtility
from zope.interface import implementer
@@ -305,14 +305,14 @@ class Trac(ExternalBugTracker):
def needs_authentication(func):
"""Decorator for automatically authenticating if needed.
- If an `xmlrpc_client.ProtocolError` with error code 403 is raised by the
+ If an `xmlrpc.client.ProtocolError` with error code 403 is raised by the
function, we'll try to authenticate and call the function again.
"""
def decorator(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
- except xmlrpc_client.ProtocolError as error:
+ except xmlrpc.client.ProtocolError as error:
# Catch authentication errors only.
if error.errcode != 403:
raise
@@ -340,7 +340,7 @@ class TracLPPlugin(Trac):
self._internal_xmlrpc_transport = internal_xmlrpc_transport
xmlrpc_endpoint = urlappend(self.baseurl, 'xmlrpc')
- self._server = xmlrpc_client.ServerProxy(
+ self._server = xmlrpc.client.ServerProxy(
xmlrpc_endpoint, transport=self._xmlrpc_transport)
def makeRequest(self, method, url, **kwargs):
@@ -365,7 +365,7 @@ class TracLPPlugin(Trac):
@ensure_no_transaction
def _generateAuthenticationToken(self):
"""Create an authentication token and return it."""
- internal_xmlrpc = xmlrpc_client.ServerProxy(
+ internal_xmlrpc = xmlrpc.client.ServerProxy(
config.checkwatches.xmlrpc_url,
transport=self._internal_xmlrpc_transport)
return internal_xmlrpc.newBugTrackerToken()
@@ -491,7 +491,7 @@ class TracLPPlugin(Trac):
try:
timestamp, lp_bug_id = self._server.launchpad.get_launchpad_bug(
remote_bug)
- except xmlrpc_client.Fault as fault:
+ except xmlrpc.client.Fault as fault:
# Deal with "Ticket does not exist" faults. We re-raise
# anything else, since they're a sign of a bigger problem.
if fault.faultCode == FAULT_TICKET_NOT_FOUND:
@@ -522,7 +522,7 @@ class TracLPPlugin(Trac):
try:
self._server.launchpad.set_launchpad_bug(
remote_bug, launchpad_bug_id)
- except xmlrpc_client.Fault as fault:
+ except xmlrpc.client.Fault as fault:
# Deal with "Ticket does not exist" faults. We re-raise
# anything else, since they're a sign of a bigger problem.
if fault.faultCode == FAULT_TICKET_NOT_FOUND:
diff --git a/lib/lp/bugs/externalbugtracker/xmlrpc.py b/lib/lp/bugs/externalbugtracker/xmlrpc.py
index b263982..6d63fe9 100644
--- a/lib/lp/bugs/externalbugtracker/xmlrpc.py
+++ b/lib/lp/bugs/externalbugtracker/xmlrpc.py
@@ -9,6 +9,10 @@ __all__ = [
from io import BytesIO
+from xmlrpc.client import (
+ ProtocolError,
+ Transport,
+ )
from defusedxml.xmlrpc import monkey_patch
import requests
@@ -18,10 +22,6 @@ from six.moves.urllib.parse import (
urlparse,
urlunparse,
)
-from six.moves.xmlrpc_client import (
- ProtocolError,
- Transport,
- )
from lp.bugs.externalbugtracker.base import repost_on_redirect_hook
from lp.services.config import config
diff --git a/lib/lp/bugs/scripts/checkwatches/core.py b/lib/lp/bugs/scripts/checkwatches/core.py
index 3540182..c659a77 100644
--- a/lib/lp/bugs/scripts/checkwatches/core.py
+++ b/lib/lp/bugs/scripts/checkwatches/core.py
@@ -27,10 +27,10 @@ import socket
import sys
import threading
import time
+from xmlrpc.client import ProtocolError
import pytz
import six
-from six.moves.xmlrpc_client import ProtocolError
from twisted.internet import reactor
from twisted.internet.defer import DeferredList
from twisted.internet.threads import deferToThreadPool
diff --git a/lib/lp/bugs/scripts/checkwatches/tests/test_core.py b/lib/lp/bugs/scripts/checkwatches/tests/test_core.py
index 27be1c9..f127aff 100644
--- a/lib/lp/bugs/scripts/checkwatches/tests/test_core.py
+++ b/lib/lp/bugs/scripts/checkwatches/tests/test_core.py
@@ -5,8 +5,8 @@
from datetime import datetime
import threading
import unittest
+from xmlrpc.client import ProtocolError
-from six.moves.xmlrpc_client import ProtocolError
import transaction
from zope.component import getUtility
diff --git a/lib/lp/bugs/scripts/checkwatches/utilities.py b/lib/lp/bugs/scripts/checkwatches/utilities.py
index c06207e..9c7ac94 100644
--- a/lib/lp/bugs/scripts/checkwatches/utilities.py
+++ b/lib/lp/bugs/scripts/checkwatches/utilities.py
@@ -9,8 +9,7 @@ __all__ = [
]
import socket
-
-from six.moves.xmlrpc_client import ProtocolError
+from xmlrpc.client import ProtocolError
from lp.bugs.externalbugtracker import (
BugNotFound,
diff --git a/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt b/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt
index 7d7561c..abab32e 100644
--- a/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt
+++ b/lib/lp/bugs/stories/bugtracker/xx-bugtracker-handshake-tokens.txt
@@ -5,9 +5,9 @@ Launchpad can generate LoginTokens which can then be used to
authenticate it with remote bug trackers. Generating these tokens is
done using the internal XML-RPC service.
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.testing.xmlrpc import XMLRPCTestTransport
- >>> bugtracker_api = xmlrpc_client.ServerProxy(
+ >>> bugtracker_api = xmlrpc.client.ServerProxy(
... 'http://xmlrpc-private.launchpad.test:8087/bugs',
... transport=XMLRPCTestTransport())
diff --git a/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt b/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt
index a22d598..185139b 100644
--- a/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt
+++ b/lib/lp/bugs/tests/bugzilla-api-xmlrpc-transport.txt
@@ -9,12 +9,12 @@ very similar to the TestBugzillaXMLRPCTransport, which it subclasses.
Only the parts of TestBugzillaAPIXMLRPCTransport that are different from
its ancestor will be tested here.
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.bugs.tests.externalbugtracker import (
... TestBugzillaAPIXMLRPCTransport)
>>> bugzilla_transport = TestBugzillaAPIXMLRPCTransport(
... 'http://example.com/xmlrpc.cgi')
- >>> server = xmlrpc_client.ServerProxy(
+ >>> server = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport)
diff --git a/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt b/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt
index 445dbc6..d0e385e 100644
--- a/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt
+++ b/lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt
@@ -4,12 +4,12 @@ TestBugzillaXMLRPCTransport
The TestBugzillaXMLRPCTransport is an XML-RPC transport which simulates
a remote Bugzilla instance that implements the Launchpad plugin API.
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.bugs.tests.externalbugtracker import (
... TestBugzillaXMLRPCTransport)
>>> bugzilla_transport = TestBugzillaXMLRPCTransport(
... 'http://example.com/xmlrpc.cgi')
- >>> server = xmlrpc_client.ServerProxy(
+ >>> server = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc.cgi', transport=bugzilla_transport)
The test transport will only allow calls to methods in a predefined set
diff --git a/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt b/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt
index 79fa0b0..de54f39 100644
--- a/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt
+++ b/lib/lp/bugs/tests/externalbugtracker-xmlrpc-transport.txt
@@ -22,13 +22,13 @@ request parameters as an XMLRPC parameter, and sets a cookie from the
server, 'foo=bar'.
>>> import responses
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> def test_callback(request):
- ... params = xmlrpc_client.loads(request.body)[0]
+ ... params = xmlrpc.client.loads(request.body)[0]
... return (
... 200, {'Set-Cookie': 'foo=bar'},
- ... xmlrpc_client.dumps(
+ ... xmlrpc.client.dumps(
... ([request.url] + list(params),), methodresponse=True))
Before sending the request, the transport's cookie jar is empty.
@@ -71,7 +71,7 @@ In addition to cookies sent by the server, we can set cookies locally.
foo=bar
If an error occurs trying to make the request, an
-``xmlrpc_client.ProtocolError`` is raised.
+``xmlrpc.client.ProtocolError`` is raised.
>>> request_body = """<?xml version="1.0"?>
... <methodCall>
diff --git a/lib/lp/bugs/tests/externalbugtracker.py b/lib/lp/bugs/tests/externalbugtracker.py
index a6b3ea4..cdce45f 100644
--- a/lib/lp/bugs/tests/externalbugtracker.py
+++ b/lib/lp/bugs/tests/externalbugtracker.py
@@ -14,10 +14,10 @@ import os
import random
import re
import time
+import xmlrpc.client
import responses
import six
-from six.moves import xmlrpc_client
from six.moves.urllib_parse import (
parse_qs,
urljoin,
@@ -564,7 +564,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
method on this class with the same name as the XML-RPC method is
called, with the extracted arguments passed on to it.
"""
- args, method_name = xmlrpc_client.loads(request)
+ args, method_name = xmlrpc.client.loads(request)
method_prefix, method_name = method_name.split('.')
assert method_prefix in self.methods, (
@@ -579,7 +579,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
# cookie, throw a Fault.
if (method_name in self.auth_required_methods and
not self.has_valid_auth_cookie):
- raise xmlrpc_client.Fault(410, 'Login Required')
+ raise xmlrpc.client.Fault(410, 'Login Required')
if self.print_method_calls:
if len(args) > 0:
@@ -638,7 +638,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
self._setAuthCookie()
# We always return the same user ID.
- # This has to be listified because xmlrpc_client tries to expand
+ # This has to be listified because xmlrpc.client tries to expand
# sequences of length 1.
return [{'user_id': 42}]
@@ -762,7 +762,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
# If the bug doesn't exist, raise a fault.
if int(bug_id) not in self.bugs:
- raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id)
+ raise xmlrpc.client.Fault(101, "Bug #%s does not exist." % bug_id)
# If we don't have comments for the bug already, create an empty
# comment dict.
@@ -790,7 +790,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
self.comment_id_index = comment_id
- # We have to return a list here because xmlrpc_client will try to
+ # We have to return a list here because xmlrpc.client will try to
# expand sequences of length 1. Trying to do that on a dict will
# cause it to explode.
return [{'comment_id': comment_id}]
@@ -810,7 +810,7 @@ class TestBugzillaXMLRPCTransport(RequestsTransport):
old_launchpad_id = bug['internals'].get('launchpad_id', 0)
bug['internals']['launchpad_id'] = launchpad_id
- # We need to return a list here because xmlrpc_client will try to
+ # We need to return a list here because xmlrpc.client will try to
# expand sequences of length 1, which will fail horribly when
# the sequence is in fact a dict.
return [{'launchpad_id': old_launchpad_id}]
@@ -908,7 +908,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
def version(self):
"""Return the version of Bugzilla being used."""
- # This is to work around the old "xmlrpc_client tries to expand
+ # This is to work around the old "xmlrpc.client tries to expand
# sequences of length 1" problem (see above).
return [{'version': '3.4.1+'}]
@@ -924,7 +924,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
self._setAuthCookie()
return [{'id': self.users.index(user)}]
else:
- raise xmlrpc_client.Fault(
+ raise xmlrpc.client.Fault(
300,
"The username or password you entered is not valid.")
@@ -1043,7 +1043,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
# If the bug doesn't exist, raise a fault.
if int(bug_id) not in self.bugs:
- raise xmlrpc_client.Fault(101, "Bug #%s does not exist." % bug_id)
+ raise xmlrpc.client.Fault(101, "Bug #%s does not exist." % bug_id)
# If we don't have comments for the bug already, create an empty
# comment dict.
@@ -1072,7 +1072,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
self.comment_id_index = comment_id
- # We have to return a list here because xmlrpc_client will try to
+ # We have to return a list here because xmlrpc.client will try to
# expand sequences of length 1. Trying to do that on a dict will
# cause it to explode.
return [{'id': comment_id}]
@@ -1091,7 +1091,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
# If the bug ID doesn't exist, raise a Fault.
if bug_id not in self.bugs:
- raise xmlrpc_client.Fault(
+ raise xmlrpc.client.Fault(
101, "Bug #%s does not exist." % bug_id)
see_also_list = self.bugs[bug_id].get('see_also', [])
@@ -1122,7 +1122,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
if ('launchpad' not in url and
'show_bug.cgi' not in url):
- raise xmlrpc_client.Fault(
+ raise xmlrpc.client.Fault(
112, "Bug URL %s is invalid." % url)
if changes.get(bug_id) is None:
@@ -1140,7 +1140,7 @@ class TestBugzillaAPIXMLRPCTransport(TestBugzillaXMLRPCTransport):
# Replace the bug's existing see_also list.
self.bugs[bug_id]['see_also'] = see_also_list
- # We have to return a list here because xmlrpc_client will try to
+ # We have to return a list here because xmlrpc.client will try to
# expand sequences of length 1. Trying to do that on a dict will
# cause it to explode.
return [{'changes': changes}]
@@ -1267,7 +1267,7 @@ class TestInternalXMLRPCTransport:
self.quiet = quiet
def request(self, host, handler, request, verbose=None):
- args, method_name = xmlrpc_client.loads(request)
+ args, method_name = xmlrpc.client.loads(request)
method = getattr(self, method_name)
with lp_dbuser():
return method(*args)
@@ -1327,14 +1327,14 @@ class TestTracXMLRPCTransport(RequestsTransport):
"""
assert handler.endswith('/xmlrpc'), (
'The Trac endpoint must end with /xmlrpc')
- args, method_name = xmlrpc_client.loads(request)
+ args, method_name = xmlrpc.client.loads(request)
prefix = 'launchpad.'
assert method_name.startswith(prefix), (
'All methods should be in the launchpad namespace')
if (self.auth_cookie is None or
self.auth_cookie == self.expired_cookie):
# All the Trac XML-RPC methods need authentication.
- raise xmlrpc_client.ProtocolError(
+ raise xmlrpc.client.ProtocolError(
method_name, errcode=403, errmsg="Forbidden",
headers=None)
@@ -1522,7 +1522,7 @@ class TestTracXMLRPCTransport(RequestsTransport):
return 0. Otherwise return the mapped Launchpad bug ID.
"""
if bugid not in self.remote_bugs:
- raise xmlrpc_client.Fault(
+ raise xmlrpc.client.Fault(
FAULT_TICKET_NOT_FOUND, 'Ticket does not exist')
return [self.utc_time, self.launchpad_bugs.get(bugid, 0)]
@@ -1536,12 +1536,12 @@ class TestTracXMLRPCTransport(RequestsTransport):
Return the current UTC timestamp.
"""
if bugid not in self.remote_bugs:
- raise xmlrpc_client.Fault(
+ raise xmlrpc.client.Fault(
FAULT_TICKET_NOT_FOUND, 'Ticket does not exist')
self.launchpad_bugs[bugid] = launchpad_bug
- # Return a list, since xmlrpc_client insists on trying to expand
+ # Return a list, since xmlrpc.client insists on trying to expand
# results.
return [self.utc_time]
@@ -1698,7 +1698,7 @@ class TestDebBugs(DebBugs):
def ensure_response_parser_is_expat(transport):
"""Ensure the transport always selects the Expat-based response parser.
- The response parser is chosen by xmlrpc_client at runtime from a number
+ The response parser is chosen by xmlrpc.client at runtime from a number
of choices, but the main Launchpad production environment selects Expat
at present.
@@ -1707,8 +1707,8 @@ def ensure_response_parser_is_expat(transport):
response parsers to be chosen.
"""
def getparser():
- target = xmlrpc_client.Unmarshaller(
+ target = xmlrpc.client.Unmarshaller(
use_datetime=transport._use_datetime)
- parser = xmlrpc_client.ExpatParser(target)
+ parser = xmlrpc.client.ExpatParser(target)
return parser, target
transport.getparser = getparser
diff --git a/lib/lp/bugs/tests/trac-xmlrpc-transport.txt b/lib/lp/bugs/tests/trac-xmlrpc-transport.txt
index 8703cb3..2da5fbb 100644
--- a/lib/lp/bugs/tests/trac-xmlrpc-transport.txt
+++ b/lib/lp/bugs/tests/trac-xmlrpc-transport.txt
@@ -6,11 +6,11 @@ Trac plugin. It can be used to avoid network traffic while testing, and
it implements the same API that Trac instances having the LP plugin
installed implement.
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.bugs.tests.externalbugtracker import (
... TestTracXMLRPCTransport)
>>> trac_transport = TestTracXMLRPCTransport('http://example.com/xmlrpc')
- >>> server = xmlrpc_client.ServerProxy(
+ >>> server = xmlrpc.client.ServerProxy(
... 'http://example.com/xmlrpc', transport=trac_transport)
All the methods need an authentication cookie to be sent.
diff --git a/lib/lp/buildmaster/interactor.py b/lib/lp/buildmaster/interactor.py
index 59f7612..796ea92 100644
--- a/lib/lp/buildmaster/interactor.py
+++ b/lib/lp/buildmaster/interactor.py
@@ -551,7 +551,7 @@ class BuilderInteractor(object):
if builder_status == "BuilderStatus.ABORTING":
logtail = u"Waiting for slave process to be terminated"
elif slave_status.get("logtail") is not None:
- # slave_status["logtail"] is an xmlrpc_client.Binary instance,
+ # slave_status["logtail"] is an xmlrpc.client.Binary instance,
# and the contents might include invalid UTF-8 due to being a
# fixed number of bytes from the tail of the log. Turn it into
# Unicode as best we can.
diff --git a/lib/lp/buildmaster/tests/mock_slaves.py b/lib/lp/buildmaster/tests/mock_slaves.py
index df9d0fb..78fa6dc 100644
--- a/lib/lp/buildmaster/tests/mock_slaves.py
+++ b/lib/lp/buildmaster/tests/mock_slaves.py
@@ -20,11 +20,11 @@ __all__ = [
from collections import OrderedDict
import os
import sys
+import xmlrpc.client
import fixtures
from lpbuildd.tests.harness import BuilddSlaveTestSetup
import six
-from six.moves import xmlrpc_client
from testtools.content import attach_file
from twisted.internet import defer
from twisted.web import xmlrpc
@@ -160,7 +160,7 @@ class BuildingSlave(OkSlave):
def status(self):
self.call_log.append('status')
- buildlog = xmlrpc_client.Binary(
+ buildlog = xmlrpc.client.Binary(
b"This is a build log: %d" % self.status_count)
self.status_count += 1
return defer.succeed({
@@ -238,7 +238,7 @@ class AbortingSlave(OkSlave):
class LostBuildingBrokenSlave:
"""A mock slave building bogus Build/BuildQueue IDs that can't be aborted.
- When 'aborted' it raises an xmlrpc_client.Fault(8002, 'Could not abort')
+ When 'aborted' it raises an xmlrpc.client.Fault(8002, 'Could not abort')
"""
def __init__(self):
@@ -253,7 +253,7 @@ class LostBuildingBrokenSlave:
def abort(self):
self.call_log.append('abort')
- return defer.fail(xmlrpc_client.Fault(8002, "Could not abort"))
+ return defer.fail(xmlrpc.client.Fault(8002, "Could not abort"))
def resume(self):
self.call_log.append('resume')
@@ -268,7 +268,7 @@ class BrokenSlave:
def status(self):
self.call_log.append('status')
- return defer.fail(xmlrpc_client.Fault(8001, "Broken slave"))
+ return defer.fail(xmlrpc.client.Fault(8001, "Broken slave"))
class TrivialBehaviour:
diff --git a/lib/lp/buildmaster/tests/test_interactor.py b/lib/lp/buildmaster/tests/test_interactor.py
index 19572f2..013ab32 100644
--- a/lib/lp/buildmaster/tests/test_interactor.py
+++ b/lib/lp/buildmaster/tests/test_interactor.py
@@ -12,10 +12,10 @@ import hashlib
import os
import signal
import tempfile
+import xmlrpc.client
from lpbuildd.builder import BuilderStatus
import six
-from six.moves import xmlrpc_client
from testtools.matchers import ContainsAll
from testtools.testcase import ExpectedException
from testtools.twistedsupport import (
@@ -291,7 +291,7 @@ class TestBuilderInteractorCleanSlave(TestCase):
try:
yield BuilderInteractor.cleanSlave(
vitals, slave, MockBuilderFactory(builder, None))
- except xmlrpc_client.Fault:
+ except xmlrpc.client.Fault:
self.assertEqual(['status', 'abort'], slave.call_log)
else:
self.fail("abort() should crash.")
@@ -325,7 +325,7 @@ class TestBuilderSlaveStatus(TestCase):
del status["build_id"]
if logtail:
tail = status.pop("logtail")
- self.assertIsInstance(tail, xmlrpc_client.Binary)
+ self.assertIsInstance(tail, xmlrpc.client.Binary)
self.assertEqual(expected, status)
@@ -584,7 +584,7 @@ class TestSlave(TestCase):
status = yield slave.status()
self.assertEqual(BuilderStatus.BUILDING, status['builder_status'])
self.assertEqual(build_id, status['build_id'])
- self.assertIsInstance(status['logtail'], xmlrpc_client.Binary)
+ self.assertIsInstance(status['logtail'], xmlrpc.client.Binary)
@defer.inlineCallbacks
def test_ensurepresent_not_there(self):
diff --git a/lib/lp/buildmaster/tests/test_manager.py b/lib/lp/buildmaster/tests/test_manager.py
index 0187dc2..fd84f13 100644
--- a/lib/lp/buildmaster/tests/test_manager.py
+++ b/lib/lp/buildmaster/tests/test_manager.py
@@ -11,9 +11,9 @@ import os
import signal
import time
from unittest import mock
+import xmlrpc.client
import six
-from six.moves import xmlrpc_client
from testtools.matchers import Equals
from testtools.testcase import ExpectedException
from testtools.twistedsupport import AsynchronousDeferredRunTest
@@ -308,7 +308,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
builder.failure_count = 0
transaction.commit()
scanner = self._getScanner(builder_name=builder.name)
- with ExpectedException(xmlrpc_client.Fault):
+ with ExpectedException(xmlrpc.client.Fault):
yield scanner.scan()
@defer.inlineCallbacks
@@ -319,7 +319,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
@defer.inlineCallbacks
def status(self):
status = yield super(BrokenUTF8Slave, self).status()
- status["logtail"] = xmlrpc_client.Binary(
+ status["logtail"] = xmlrpc.client.Binary(
u"───".encode("UTF-8")[1:])
return status
@@ -349,7 +349,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
@defer.inlineCallbacks
def status(self):
status = yield super(NULSlave, self).status()
- status["logtail"] = xmlrpc_client.Binary(b"foo\0bar\0baz")
+ status["logtail"] = xmlrpc.client.Binary(b"foo\0bar\0baz")
return status
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
@@ -1196,7 +1196,7 @@ class TestCancellationChecking(TestCaseWithFactory):
slave = LostBuildingBrokenSlave()
self.builder.current_build.cancel()
with ExpectedException(
- xmlrpc_client.Fault, "<Fault 8002: %r>" % 'Could not abort'):
+ xmlrpc.client.Fault, "<Fault 8002: %r>" % 'Could not abort'):
yield self._getScanner().checkCancellation(self.vitals, slave)
diff --git a/lib/lp/code/doc/branch-xmlrpc.txt b/lib/lp/code/doc/branch-xmlrpc.txt
index ba2981b..80e782b 100644
--- a/lib/lp/code/doc/branch-xmlrpc.txt
+++ b/lib/lp/code/doc/branch-xmlrpc.txt
@@ -1,7 +1,7 @@
IPublicCodehostingAPI
=====================
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.testing.xmlrpc import XMLRPCTestTransport
@@ -17,7 +17,7 @@ Bazaar is strictly unsupported.
This API is deprecated, and will eventually be replaced with an
equivalent method in the new Launchpad API infrastructure.
- >>> public_codehosting_api = xmlrpc_client.ServerProxy(
+ >>> public_codehosting_api = xmlrpc.client.ServerProxy(
... 'http://xmlrpc.launchpad.test/bazaar/',
... transport=XMLRPCTestTransport())
diff --git a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
index e60b0d7..ba4b363 100644
--- a/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
+++ b/lib/lp/code/doc/xmlrpc-codeimport-scheduler.txt
@@ -42,9 +42,9 @@ can be found in the tests for ICodeImportJobSet.
The point of all this is for it to be accessed over XMLRPC.
- >>> from six.moves import xmlrpc_client
+ >>> import xmlrpc.client
>>> from lp.testing.xmlrpc import XMLRPCTestTransport
- >>> codeimportscheduler = xmlrpc_client.ServerProxy(
+ >>> codeimportscheduler = xmlrpc.client.ServerProxy(
... 'http://xmlrpc-private.launchpad.test:8087/codeimportscheduler',
... transport=XMLRPCTestTransport())
>>> codeimportscheduler.getJobForMachine('bazaar-importer', 2)
diff --git a/lib/lp/code/interfaces/codeimportscheduler.py b/lib/lp/code/interfaces/codeimportscheduler.py
index 47d2b3c..ea1a095 100644
--- a/lib/lp/code/interfaces/codeimportscheduler.py
+++ b/lib/lp/code/interfaces/codeimportscheduler.py
@@ -59,8 +59,8 @@ class ICodeImportScheduler(Interface):
:param job_id: The ID of the code import job to finish.
:param status_name: The outcome of the job as the name of a
`CodeImportResultStatus` item.
- :param log_file: A log file to display for diagnostics, either as a
- `six.moves.xmlrpc_client.Binary` containing the log file data or
+ :param log_file: A log file to display for diagnostics, either as an
+ `xmlrpc.client.Binary` containing the log file data or
as the URL of a file in the librarian.
:raise NoSuchCodeImportJob: if no job with id `job_id` exists.
"""
diff --git a/lib/lp/code/xmlrpc/branch.py b/lib/lp/code/xmlrpc/branch.py
index 235e23e..4833639 100644
--- a/lib/lp/code/xmlrpc/branch.py
+++ b/lib/lp/code/xmlrpc/branch.py
@@ -8,9 +8,9 @@ __all__ = [
'PublicCodehostingAPI',
]
+from xmlrpc.client import Fault
from breezy import urlutils
-from six.moves.xmlrpc_client import Fault
from zope.component import getUtility
from zope.interface import (
implementer,
diff --git a/lib/lp/code/xmlrpc/codeimportscheduler.py b/lib/lp/code/xmlrpc/codeimportscheduler.py
index 0641af4..966b271 100644
--- a/lib/lp/code/xmlrpc/codeimportscheduler.py
+++ b/lib/lp/code/xmlrpc/codeimportscheduler.py
@@ -8,9 +8,9 @@ __all__ = [
]
import io
+import xmlrpc.client
import six
-from six.moves import xmlrpc_client
from zope.component import getUtility
from zope.interface import implementer
from zope.security.proxy import removeSecurityProxy
@@ -92,7 +92,7 @@ class CodeImportSchedulerAPI(LaunchpadXMLRPCView):
job = self._getJob(job_id)
status = CodeImportResultStatus.items[status_name]
workflow = removeSecurityProxy(getUtility(ICodeImportJobWorkflow))
- if isinstance(log_file, xmlrpc_client.Binary):
+ if isinstance(log_file, xmlrpc.client.Binary):
if log_file.data:
log_file_name = '%s.log' % (
job.code_import.target.unique_name[1:].replace('/', '-'))
diff --git a/lib/lp/code/xmlrpc/git.py b/lib/lp/code/xmlrpc/git.py
index b73df08..c7940f0 100644
--- a/lib/lp/code/xmlrpc/git.py
+++ b/lib/lp/code/xmlrpc/git.py
@@ -10,10 +10,10 @@ __all__ = [
import logging
import sys
import uuid
+import xmlrpc.client
from pymacaroons import Macaroon
import six
-from six.moves import xmlrpc_client
from six.moves.urllib.parse import quote
import transaction
from zope.component import (
@@ -454,7 +454,7 @@ class GitAPI(LaunchpadXMLRPCView):
requester_id, self._translatePath,
six.ensure_text(path).strip("/"), permission, auth_params)
try:
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
logger.error("translatePath failed: %r", result)
else:
# The results of path translation are not sensitive for
@@ -502,7 +502,7 @@ class GitAPI(LaunchpadXMLRPCView):
requester_id, self._notify,
translated_path, statistics, auth_params)
try:
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
logger.error("notify failed: %r", result)
else:
logger.info("notify succeeded: %s" % result)
@@ -544,7 +544,7 @@ class GitAPI(LaunchpadXMLRPCView):
requester_id, self._getMergeProposalURL,
translated_path, branch, auth_params)
try:
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
logger.error("getMergeProposalURL failed: %r", result)
else:
# The result of getMergeProposalURL is not sensitive for
@@ -586,7 +586,7 @@ class GitAPI(LaunchpadXMLRPCView):
"Request received: authenticateWithPassword('%s')", username)
result = self._authenticateWithPassword(username, password)
try:
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
logger.error("authenticateWithPassword failed: %r", result)
else:
# The results of authentication may be sensitive, but we can
@@ -640,7 +640,7 @@ class GitAPI(LaunchpadXMLRPCView):
# the moment. It's possible to reach this by being very unlucky
# about the timing of a push.
return [
- (xmlrpc_client.Binary(ref_path.data), [])
+ (xmlrpc.client.Binary(ref_path.data), [])
for ref_path in ref_paths]
# Caller sends paths as bytes; Launchpad returns a list of (path,
@@ -648,7 +648,7 @@ class GitAPI(LaunchpadXMLRPCView):
# bytes.)
ref_paths = [ref_path.data for ref_path in ref_paths]
return [
- (xmlrpc_client.Binary(ref_path),
+ (xmlrpc.client.Binary(ref_path),
self._renderPermissions(permissions))
for ref_path, permissions in repository.checkRefPermissions(
requester, ref_paths).items()
@@ -666,7 +666,7 @@ class GitAPI(LaunchpadXMLRPCView):
requester_id, self._checkRefPermissions,
translated_path, ref_paths, auth_params)
try:
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
logger.error("checkRefPermissions failed: %r", result)
else:
# The results of ref permission checks are not sensitive for
@@ -736,7 +736,7 @@ class GitAPI(LaunchpadXMLRPCView):
except Exception as e:
result = e
try:
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
logger.error("confirmRepoCreation failed: %r", result)
else:
logger.info("confirmRepoCreation succeeded: %s" % result)
@@ -767,7 +767,7 @@ class GitAPI(LaunchpadXMLRPCView):
except Exception as e:
result = e
try:
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
logger.error("abortRepoCreation failed: %r", result)
else:
logger.info("abortRepoCreation succeeded: %s" % result)
diff --git a/lib/lp/code/xmlrpc/tests/test_branch.py b/lib/lp/code/xmlrpc/tests/test_branch.py
index 898ebd6..41d55d7 100644
--- a/lib/lp/code/xmlrpc/tests/test_branch.py
+++ b/lib/lp/code/xmlrpc/tests/test_branch.py
@@ -4,10 +4,10 @@
"""Unit tests for the public codehosting API."""
import os
+import xmlrpc.client
from breezy import urlutils
from lazr.uri import URI
-from six.moves import xmlrpc_client
from zope.security.proxy import removeSecurityProxy
from lp.app.enums import InformationType
@@ -79,7 +79,7 @@ class TestExpandURL(TestCaseWithFactory):
api = PublicCodehostingAPI(None, None)
fault = api.resolve_lp_path(lp_url_path)
self.assertTrue(
- isinstance(fault, xmlrpc_client.Fault),
+ isinstance(fault, xmlrpc.client.Fault),
"resolve_lp_path(%r) returned %r, not a Fault."
% (lp_url_path, fault))
self.assertEqual(expected_fault.__class__, fault.__class__)
diff --git a/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py b/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py
index 8a77f5b..7c0ec97 100644
--- a/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py
+++ b/lib/lp/code/xmlrpc/tests/test_codeimportscheduler.py
@@ -3,7 +3,8 @@
"""Test for the methods of `ICodeImportScheduler`."""
-from six.moves import xmlrpc_client
+import xmlrpc.client
+
import transaction
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
@@ -76,7 +77,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
# is no code import job with the given ID.
fault = self.api.getImportDataForJobID(-1)
self.assertTrue(
- isinstance(fault, xmlrpc_client.Fault),
+ isinstance(fault, xmlrpc.client.Fault),
"getImportDataForJobID(-1) returned %r, not a Fault."
% (fault,))
self.assertEqual(NoSuchCodeImportJob, fault.__class__)
@@ -95,7 +96,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
# code import job with the given ID.
fault = self.api.updateHeartbeat(-1, '')
self.assertTrue(
- isinstance(fault, xmlrpc_client.Fault),
+ isinstance(fault, xmlrpc.client.Fault),
"updateHeartbeat(-1, '') returned %r, not a Fault."
% (fault,))
self.assertEqual(NoSuchCodeImportJob, fault.__class__)
@@ -131,7 +132,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
code_import = code_import_job.code_import
self.api.finishJobID(
code_import_job.id, CodeImportResultStatus.SUCCESS.name,
- xmlrpc_client.Binary(b'log file data\n'))
+ xmlrpc.client.Binary(b'log file data\n'))
transaction.commit()
self.assertEqual(
b'log file data\n', code_import.results.last().log_file.read())
@@ -143,7 +144,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
code_import = code_import_job.code_import
self.api.finishJobID(
code_import_job.id, CodeImportResultStatus.SUCCESS.name,
- xmlrpc_client.Binary(b''))
+ xmlrpc.client.Binary(b''))
self.assertIsNone(code_import.results.last().log_file)
def test_finishJobID_not_found(self):
@@ -152,7 +153,7 @@ class TestCodeImportSchedulerAPI(TestCaseWithFactory):
fault = self.api.finishJobID(
-1, CodeImportResultStatus.SUCCESS.name, '')
self.assertTrue(
- isinstance(fault, xmlrpc_client.Fault),
+ isinstance(fault, xmlrpc.client.Fault),
"finishJobID(-1, 'SUCCESS', 0) returned %r, not a Fault."
% (fault,))
self.assertEqual(NoSuchCodeImportJob, fault.__class__)
diff --git a/lib/lp/code/xmlrpc/tests/test_git.py b/lib/lp/code/xmlrpc/tests/test_git.py
index 6726db0..27c78c4 100644
--- a/lib/lp/code/xmlrpc/tests/test_git.py
+++ b/lib/lp/code/xmlrpc/tests/test_git.py
@@ -6,12 +6,12 @@
from datetime import datetime
import hashlib
import uuid
+import xmlrpc.client
from fixtures import FakeLogger
from pymacaroons import Macaroon
import pytz
import six
-from six.moves import xmlrpc_client
from six.moves.urllib.parse import quote
from storm.store import Store
from testtools.matchers import (
@@ -157,7 +157,7 @@ class TestGitAPIMixin:
def setUp(self):
super(TestGitAPIMixin, self).setUp()
- self.git_api = xmlrpc_client.ServerProxy(
+ self.git_api = xmlrpc.client.ServerProxy(
"http://xmlrpc-private.launchpad.test:8087/git",
transport=XMLRPCTestTransport())
self.hosting_fixture = self.useFixture(GitHostingFixture())
@@ -169,7 +169,7 @@ class TestGitAPIMixin:
"""Assert that a call raises the expected fault."""
with FakeLogger() as logger:
fault = self.assertRaises(
- xmlrpc_client.Fault, getattr(self.git_api, func_name),
+ xmlrpc.client.Fault, getattr(self.git_api, func_name),
*args, **kwargs)
self.assertThat(fault, MatchesFault(expected_fault))
self.assertThat(logger.output, MatchesRegex(
@@ -468,14 +468,14 @@ class TestGitAPIMixin:
request_id = auth_params["request-id"]
translated_path = removeSecurityProxy(repository).getInternalPath()
ref_paths = [
- xmlrpc_client.Binary(ref_path) for ref_path in ref_paths]
+ xmlrpc.client.Binary(ref_path) for ref_path in ref_paths]
results = self.assertDoesNotFault(
request_id, "checkRefPermissions",
translated_path, ref_paths, auth_params)
self.assertThat(results, MatchesSetwise(*(
MatchesListwise([
MatchesAll(
- IsInstance(xmlrpc_client.Binary),
+ IsInstance(xmlrpc.client.Binary),
MatchesStructure.byEquality(data=ref_path)),
Equals(ref_permissions),
])
diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
index f23c4e5..d68cc22 100644
--- a/lib/lp/codehosting/inmemory.py
+++ b/lib/lp/codehosting/inmemory.py
@@ -9,13 +9,13 @@ __all__ = [
]
import operator
+from xmlrpc.client import Fault
from breezy.urlutils import (
escape,
unescape,
)
import six
-from six.moves.xmlrpc_client import Fault
from twisted.internet import defer
from zope.component import (
adapter,
diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py
index 1bf9d70..7189670 100644
--- a/lib/lp/codehosting/tests/test_acceptance.py
+++ b/lib/lp/codehosting/tests/test_acceptance.py
@@ -5,6 +5,7 @@
import os
import re
+import xmlrpc.client
import breezy.branch
from breezy.tests import TestCaseWithTransport
@@ -12,7 +13,6 @@ from breezy.tests.per_repository import all_repository_format_scenarios
from breezy.urlutils import local_path_from_url
from breezy.workingtree import WorkingTree
import six
-from six.moves import xmlrpc_client
from six.moves.urllib.request import urlopen
from testscenarios import (
load_tests_apply_scenarios,
@@ -229,9 +229,9 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
Used to create branches that the test user is not able to create, and
might not even be able to view.
"""
- authserver = xmlrpc_client.ServerProxy(
+ authserver = xmlrpc.client.ServerProxy(
config.codehosting.authentication_endpoint)
- codehosting_api = xmlrpc_client.ServerProxy(
+ codehosting_api = xmlrpc.client.ServerProxy(
config.codehosting.codehosting_endpoint)
if creator is None:
creator_id = authserver.getUserAndSSHKeys(user)['id']
diff --git a/lib/lp/codehosting/vfs/branchfs.py b/lib/lp/codehosting/vfs/branchfs.py
index 02cf0e0..240892b 100644
--- a/lib/lp/codehosting/vfs/branchfs.py
+++ b/lib/lp/codehosting/vfs/branchfs.py
@@ -54,6 +54,7 @@ __all__ = [
import os.path
import sys
+import xmlrpc.client
from breezy import urlutils
from breezy.bzr.bzrdir import BzrDir
@@ -69,7 +70,6 @@ from breezy.transport import get_transport
from breezy.transport.memory import MemoryServer
from lazr.uri import URI
import six
-from six.moves import xmlrpc_client
from twisted.internet import (
defer,
error,
@@ -170,7 +170,7 @@ def is_lock_directory(absolute_path):
def get_ro_server():
"""Get a Launchpad internal server for scanning branches."""
- proxy = xmlrpc_client.ServerProxy(config.codehosting.codehosting_endpoint)
+ proxy = xmlrpc.client.ServerProxy(config.codehosting.codehosting_endpoint)
codehosting_endpoint = DeferredBlockingProxy(proxy)
branch_transport = get_readonly_transport(
get_transport(config.codehosting.internal_branch_by_id_root))
@@ -193,7 +193,7 @@ def get_rw_server(direct_database=False):
if direct_database:
return DirectDatabaseLaunchpadServer('lp-internal:///', transport)
else:
- proxy = xmlrpc_client.ServerProxy(
+ proxy = xmlrpc.client.ServerProxy(
config.codehosting.codehosting_endpoint)
codehosting_endpoint = DeferredBlockingProxy(proxy)
return LaunchpadInternalServer(
@@ -749,7 +749,7 @@ def get_lp_server(user_id, codehosting_endpoint_url=None, branch_url=None,
raise AssertionError(
"can't supply both branch_url and branch_transport!")
- codehosting_client = xmlrpc_client.ServerProxy(codehosting_endpoint_url)
+ codehosting_client = xmlrpc.client.ServerProxy(codehosting_endpoint_url)
lp_server = LaunchpadServer(
DeferredBlockingProxy(codehosting_client), user_id, branch_transport,
seen_new_branch_hook)
diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py
index 057c231..d2b96a3 100644
--- a/lib/lp/codehosting/vfs/tests/test_branchfs.py
+++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py
@@ -6,6 +6,7 @@
import os
import re
import sys
+import xmlrpc.client
from breezy import errors
from breezy.bzr.bzrdir import BzrDir
@@ -33,7 +34,6 @@ from breezy.urlutils import (
)
from fixtures import MonkeyPatch
import six
-from six.moves import xmlrpc_client
from testtools.twistedsupport import (
assert_fails_with,
AsynchronousDeferredRunTest,
@@ -1035,7 +1035,7 @@ class TestBranchChangedErrorHandling(TestCaseWithTransport, TestCase):
report = errorlog.globalErrorUtility.raising(f, request)
# Record the id for checking later.
self.generated_oopsids.append(report['id'])
- raise xmlrpc_client.Fault(-1, report)
+ raise xmlrpc.client.Fault(-1, report)
def get_server(self):
if self._server is None:
diff --git a/lib/lp/registry/tests/mailinglists_helper.py b/lib/lp/registry/tests/mailinglists_helper.py
index 2f926d9..20ace5c 100644
--- a/lib/lp/registry/tests/mailinglists_helper.py
+++ b/lib/lp/registry/tests/mailinglists_helper.py
@@ -10,7 +10,8 @@ __all__ = [
'new_team',
]
-from six.moves import xmlrpc_client
+import xmlrpc.client
+
from zope.component import getUtility
from lp.registry.enums import TeamMembershipPolicy
@@ -36,7 +37,7 @@ def fault_catcher(func):
def caller(self, *args, **kws):
result = func(self, *args, **kws)
- if isinstance(result, xmlrpc_client.Fault):
+ if isinstance(result, xmlrpc.client.Fault):
raise result
else:
return result
diff --git a/lib/lp/registry/tests/test_mailinglistapi.py b/lib/lp/registry/tests/test_mailinglistapi.py
index 08f7f9c..be9f182 100644
--- a/lib/lp/registry/tests/test_mailinglistapi.py
+++ b/lib/lp/registry/tests/test_mailinglistapi.py
@@ -7,8 +7,8 @@ __all__ = []
import email
from textwrap import dedent
+import xmlrpc.client
-from six.moves import xmlrpc_client
from testtools.matchers import (
Equals,
MatchesDict,
@@ -498,7 +498,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory):
I put \xa9 in the body.
""").encode('ISO-8859-1'))
info = self.mailinglist_api.holdMessage(
- 'team', xmlrpc_client.Binary(message_as_bytes(message)))
+ 'team', xmlrpc.client.Binary(message_as_bytes(message)))
transaction.commit()
found = self.message_approval_set.getMessageByMessageID('<\\xa9-me>')
self.assertIs(True, info)
diff --git a/lib/lp/registry/tests/test_xmlrpc.py b/lib/lp/registry/tests/test_xmlrpc.py
index dc9507b..fccd0bf 100644
--- a/lib/lp/registry/tests/test_xmlrpc.py
+++ b/lib/lp/registry/tests/test_xmlrpc.py
@@ -5,8 +5,8 @@
from email import message_from_string
from textwrap import dedent
+import xmlrpc.client
-from six.moves import xmlrpc_client
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
@@ -42,7 +42,7 @@ class TestCanonicalSSOApplication(TestCaseWithFactory):
def setUp(self):
super(TestCanonicalSSOApplication, self).setUp()
- self.rpc_proxy = xmlrpc_client.ServerProxy(
+ self.rpc_proxy = xmlrpc.client.ServerProxy(
'http://xmlrpc-private.launchpad.test:8087/canonicalsso',
transport=XMLRPCTestTransport())
@@ -71,12 +71,12 @@ class TestCanonicalSSOApplication(TestCaseWithFactory):
person = self.factory.makePerson()
openid_identifier = removeSecurityProxy(
person.account).openid_identifiers.any().identifier
- public_rpc_proxy = xmlrpc_client.ServerProxy(
+ public_rpc_proxy = xmlrpc.client.ServerProxy(
'http://test@xxxxxxxxxxxxx:test@'
'xmlrpc.launchpad.test/canonicalsso',
transport=XMLRPCTestTransport())
e = self.assertRaises(
- xmlrpc_client.ProtocolError,
+ xmlrpc.client.ProtocolError,
public_rpc_proxy.getPersonDetailsByOpenIDIdentifier,
openid_identifier)
self.assertEqual(404, e.errcode)
@@ -88,7 +88,7 @@ class TestMailingListXMLRPC(TestCaseWithFactory):
def setUp(self):
super(TestMailingListXMLRPC, self).setUp()
- self.rpc_proxy = xmlrpc_client.ServerProxy(
+ self.rpc_proxy = xmlrpc.client.ServerProxy(
'http://xmlrpc-private.launchpad.test:8087/mailinglists',
transport=XMLRPCTestTransport())
@@ -147,7 +147,7 @@ class TestMailingListXMLRPCMessage(TestCaseWithFactory):
def setUp(self):
super(TestMailingListXMLRPCMessage, self).setUp()
- self.rpc_proxy = xmlrpc_client.ServerProxy(
+ self.rpc_proxy = xmlrpc.client.ServerProxy(
'http://xmlrpc-private.launchpad.test:8087/mailinglists',
transport=XMLRPCTestTransport())
diff --git a/lib/lp/registry/xmlrpc/mailinglist.py b/lib/lp/registry/xmlrpc/mailinglist.py
index 829c740..4dd50eb 100644
--- a/lib/lp/registry/xmlrpc/mailinglist.py
+++ b/lib/lp/registry/xmlrpc/mailinglist.py
@@ -8,9 +8,9 @@ __all__ = [
]
import re
+import xmlrpc.client
from six import ensure_text
-from six.moves import xmlrpc_client
from zope.component import getUtility
from zope.interface import implementer
from zope.security.proxy import removeSecurityProxy
@@ -244,7 +244,7 @@ class MailingListAPIView(LaunchpadXMLRPCView):
# non-ascii characters in the message can be safely passed across
# XMLRPC. For most tests though it's much more convenient to just
# pass 8-bit strings.
- if isinstance(bytes, xmlrpc_client.Binary):
+ if isinstance(bytes, xmlrpc.client.Binary):
bytes = bytes.data
team_name = ensure_text(team_name)
# Although it is illegal for an email header to have unencoded
diff --git a/lib/lp/services/authserver/tests/test_authserver.py b/lib/lp/services/authserver/tests/test_authserver.py
index a2319a3..98bdabc 100644
--- a/lib/lp/services/authserver/tests/test_authserver.py
+++ b/lib/lp/services/authserver/tests/test_authserver.py
@@ -3,8 +3,9 @@
"""Tests for the internal codehosting API."""
+import xmlrpc.client
+
from pymacaroons import Macaroon
-from six.moves import xmlrpc_client
from storm.sqlobject import SQLObjectNotFound
from testtools.matchers import (
Equals,
@@ -122,7 +123,7 @@ class GetUserAndSSHKeysTests(TestCaseWithFactory):
new_person = self.factory.makePerson()
with person_logged_in(new_person):
key = self.factory.makeSSHKey(person=new_person)
- authserver = xmlrpc_client.ServerProxy(
+ authserver = xmlrpc.client.ServerProxy(
'http://xmlrpc-private.launchpad.test:8087/authserver',
transport=XMLRPCTestTransport())
self.assertEqual(
diff --git a/lib/lp/services/features/__init__.py b/lib/lp/services/features/__init__.py
index 7ee4895..e58a026 100644
--- a/lib/lp/services/features/__init__.py
+++ b/lib/lp/services/features/__init__.py
@@ -131,7 +131,7 @@ Checking flags without access to the database
Feature flags can also be checked without access to the database by making use
of the 'getFeatureFlag' XML-RPC method.
- server_proxy = xmlrpc_client.ServerProxy(
+ server_proxy = xmlrpc.client.ServerProxy(
config.launchpad.feature_flags_endpoint, allow_none=True)
if server_proxy.getFeatureFlag(
'example_flag.enabled', ['user:' + user_name]):
diff --git a/lib/lp/services/features/tests/test_xmlrpc.py b/lib/lp/services/features/tests/test_xmlrpc.py
index a2523d4..10cf61c 100644
--- a/lib/lp/services/features/tests/test_xmlrpc.py
+++ b/lib/lp/services/features/tests/test_xmlrpc.py
@@ -3,7 +3,7 @@
"""Tests for FeatureFlagApplication."""
-from six.moves import xmlrpc_client
+import xmlrpc.client
from lp.services import features
from lp.services.config import config
@@ -82,13 +82,13 @@ class TestGetFeatureFlag(TestCaseWithFactory):
flag_name, ['user:' + person.name]))
def test_xmlrpc_interface_unset(self):
- sp = xmlrpc_client.ServerProxy(
+ sp = xmlrpc.client.ServerProxy(
config.launchpad.feature_flags_endpoint,
transport=XMLRPCTestTransport(), allow_none=True)
self.assertEqual(None, sp.getFeatureFlag(u'flag'))
def test_xmlrpc_interface_set(self):
- sp = xmlrpc_client.ServerProxy(
+ sp = xmlrpc.client.ServerProxy(
config.launchpad.feature_flags_endpoint,
transport=XMLRPCTestTransport(), allow_none=True)
flag_name = u'flag'
diff --git a/lib/lp/services/librarianserver/db.py b/lib/lp/services/librarianserver/db.py
index 972ca8f..4ed2901 100644
--- a/lib/lp/services/librarianserver/db.py
+++ b/lib/lp/services/librarianserver/db.py
@@ -8,13 +8,13 @@ __all__ = [
]
import hashlib
+from xmlrpc.client import Fault
from pymacaroons import Macaroon
from six.moves.urllib.parse import (
quote,
unquote,
)
-from six.moves.xmlrpc_client import Fault
from storm.expr import (
And,
SQL,
diff --git a/lib/lp/services/tests/test_timeout.py b/lib/lp/services/tests/test_timeout.py
index 6aa31d5..b337a5d 100644
--- a/lib/lp/services/tests/test_timeout.py
+++ b/lib/lp/services/tests/test_timeout.py
@@ -7,6 +7,7 @@
import socket
from textwrap import dedent
import threading
+import xmlrpc.client
from fixtures import (
MonkeyPatch,
@@ -17,10 +18,7 @@ from requests.exceptions import (
ConnectionError,
InvalidSchema,
)
-from six.moves import (
- xmlrpc_client,
- xmlrpc_server,
- )
+from six.moves import xmlrpc_server
from testtools.matchers import (
ContainsDict,
Equals,
@@ -505,7 +503,7 @@ class TestTimeout(TestCase):
logRequests=False)
server_thread = threading.Thread(target=server.serve_2_requests)
server_thread.start()
- proxy = xmlrpc_client.ServerProxy(
+ proxy = xmlrpc.client.ServerProxy(
http_server_url, transport=TransportWithTimeout())
self.assertEqual('Successful test message.',
proxy.echo('Successful test message.'))
diff --git a/lib/lp/services/timeout.py b/lib/lp/services/timeout.py
index 815e08b..ff88dbe 100644
--- a/lib/lp/services/timeout.py
+++ b/lib/lp/services/timeout.py
@@ -24,6 +24,7 @@ from threading import (
Lock,
Thread,
)
+from xmlrpc.client import Transport
from requests import (
HTTPError,
@@ -37,7 +38,6 @@ from requests_file import FileAdapter
from requests_toolbelt.downloadutils import stream
import six
from six import reraise
-from six.moves.xmlrpc_client import Transport
from urllib3.connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
diff --git a/lib/lp/services/twistedsupport/xmlrpc.py b/lib/lp/services/twistedsupport/xmlrpc.py
index 4c93d77..209f360 100644
--- a/lib/lp/services/twistedsupport/xmlrpc.py
+++ b/lib/lp/services/twistedsupport/xmlrpc.py
@@ -26,7 +26,7 @@ class BlockingProxy:
def __init__(self, proxy):
"""Construct a `BlockingProxy`.
- :param proxy: An xmlrpc_client.ServerProxy.
+ :param proxy: An xmlrpc.client.ServerProxy.
"""
self._proxy = proxy
@@ -39,7 +39,7 @@ class DeferredBlockingProxy(BlockingProxy):
This is almost exactly like 'BlockingProxy', except that this returns
Deferreds. It is guaranteed to be exactly as synchronous as the passed-in
- proxy. That means if you pass in a normal xmlrpc_client proxy you ought to
+ proxy. That means if you pass in a normal xmlrpc.client proxy you ought to
be able to use `lp.services.twistedsupport.extract_result` to get the
result.
"""
diff --git a/lib/lp/services/webapp/servers.py b/lib/lp/services/webapp/servers.py
index 31afcbf..eef5ede 100644
--- a/lib/lp/services/webapp/servers.py
+++ b/lib/lp/services/webapp/servers.py
@@ -4,6 +4,7 @@
"""Definition of the internet servers that Launchpad uses."""
import threading
+import xmlrpc.client
from lazr.restful.interfaces import (
ICollectionResource,
@@ -17,7 +18,6 @@ from lazr.restful.publisher import (
from lazr.restful.utils import get_current_browser_request
from lazr.uri import URI
import six
-from six.moves import xmlrpc_client
from six.moves.urllib.parse import parse_qs
from talisker.logs import logging_context
import transaction
@@ -1403,15 +1403,15 @@ class PublicXMLRPCResponse(XMLRPCResponse):
"""Response type for doing public XML-RPC in Launchpad."""
def handleException(self, exc_info):
- # If we don't have a proper xmlrpc_client.Fault, and we have
+ # If we don't have a proper xmlrpc.client.Fault, and we have
# logged an OOPS, create a Fault that reports the OOPS ID to
# the user.
exc_value = exc_info[1]
- if not isinstance(exc_value, xmlrpc_client.Fault):
+ if not isinstance(exc_value, xmlrpc.client.Fault):
request = get_current_browser_request()
if request is not None and request.oopsid is not None:
- exc_info = (xmlrpc_client.Fault,
- xmlrpc_client.Fault(-1, request.oopsid),
+ exc_info = (xmlrpc.client.Fault,
+ xmlrpc.client.Fault(-1, request.oopsid),
None)
XMLRPCResponse.handleException(self, exc_info)
diff --git a/lib/lp/services/xmlrpc.py b/lib/lp/services/xmlrpc.py
index 944dec1..f34154c 100644
--- a/lib/lp/services/xmlrpc.py
+++ b/lib/lp/services/xmlrpc.py
@@ -9,16 +9,16 @@ __all__ = [
]
import socket
+import xmlrpc.client
from defusedxml.xmlrpc import monkey_patch
-from six.moves import xmlrpc_client
# Protect against various XML parsing vulnerabilities.
monkey_patch()
-class LaunchpadFault(xmlrpc_client.Fault):
+class LaunchpadFault(xmlrpc.client.Fault):
"""Base class for a Launchpad XMLRPC fault.
Subclasses should define a unique error_code and a msg_template,
@@ -34,7 +34,7 @@ class LaunchpadFault(xmlrpc_client.Fault):
assert self.msg_template is not None, (
"Subclasses must define msg_template.")
msg = self.msg_template % kw
- xmlrpc_client.Fault.__init__(self, self.error_code, msg)
+ xmlrpc.client.Fault.__init__(self, self.error_code, msg)
def __eq__(self, other):
if not isinstance(other, LaunchpadFault):
@@ -47,19 +47,19 @@ class LaunchpadFault(xmlrpc_client.Fault):
return not (self == other)
-class Transport(xmlrpc_client.Transport):
- """An xmlrpc_client transport that supports a timeout argument.
+class Transport(xmlrpc.client.Transport):
+ """An xmlrpc.client transport that supports a timeout argument.
Use by passing into the "transport" argument of the
- xmlrpc_client.ServerProxy initialization.
+ xmlrpc.client.ServerProxy initialization.
"""
def __init__(self,
use_datetime=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
- xmlrpc_client.Transport.__init__(self, use_datetime)
+ xmlrpc.client.Transport.__init__(self, use_datetime)
self.timeout = timeout
def make_connection(self, host):
- conn = xmlrpc_client.Transport.make_connection(self, host)
+ conn = xmlrpc.client.Transport.make_connection(self, host)
conn.timeout = self.timeout
return conn
diff --git a/lib/lp/soyuz/model/livefsbuildbehaviour.py b/lib/lp/soyuz/model/livefsbuildbehaviour.py
index acf8999..700e5c0 100644
--- a/lib/lp/soyuz/model/livefsbuildbehaviour.py
+++ b/lib/lp/soyuz/model/livefsbuildbehaviour.py
@@ -95,7 +95,7 @@ class LiveFSBuildBehaviour(BuildFarmJobBehaviourBase):
base_args = yield super(LiveFSBuildBehaviour, self).extraBuildArgs(
logger=logger)
# Non-trivial metadata values may have been security-wrapped, which
- # is pointless here and just gets in the way of xmlrpc_client
+ # is pointless here and just gets in the way of xmlrpc.client
# serialisation.
args = dict(removeSecurityProxy(build.livefs.metadata))
if build.metadata_override is not None:
diff --git a/lib/lp/soyuz/wsgi/archiveauth.py b/lib/lp/soyuz/wsgi/archiveauth.py
index 19db4a8..dc0dece 100644
--- a/lib/lp/soyuz/wsgi/archiveauth.py
+++ b/lib/lp/soyuz/wsgi/archiveauth.py
@@ -15,13 +15,13 @@ from random import SystemRandom
import string
import sys
import time
-
-import six
-from six.moves.xmlrpc_client import (
+from xmlrpc.client import (
Fault,
ServerProxy,
)
+import six
+
from lp.services.config import config
from lp.services.memcache.client import memcache_client_factory
diff --git a/lib/lp/testing/xmlrpc.py b/lib/lp/testing/xmlrpc.py
index 644a22d..82ac254 100644
--- a/lib/lp/testing/xmlrpc.py
+++ b/lib/lp/testing/xmlrpc.py
@@ -9,8 +9,8 @@ __all__ = [
import http.client as http_client
import io
+import xmlrpc.client
-from six.moves import xmlrpc_client
from zope.security.management import (
endInteraction,
queryInteraction,
@@ -38,7 +38,7 @@ class _FakeSocket(object):
class TestHTTPConnection(http_client.HTTPConnection):
"""A HTTPConnection which talks to http() instead of a real server.
- Only the methods called by xmlrpc_client are overridden.
+ Only the methods called by xmlrpc.client are overridden.
"""
_data_to_send = b''
@@ -76,7 +76,7 @@ class TestHTTPConnection(http_client.HTTPConnection):
return response
-class XMLRPCTestTransport(xmlrpc_client.Transport):
+class XMLRPCTestTransport(xmlrpc.client.Transport):
"""An XMLRPC Transport which sends the requests to http()."""
def make_connection(self, host):
diff --git a/lib/lp/xmlrpc/application.py b/lib/lp/xmlrpc/application.py
index b855323..1b23765 100644
--- a/lib/lp/xmlrpc/application.py
+++ b/lib/lp/xmlrpc/application.py
@@ -9,7 +9,8 @@ __all__ = [
'SelfTest',
]
-from six.moves import xmlrpc_client
+import xmlrpc.client
+
from zope.component import getUtility
from zope.interface import (
implementer,
@@ -104,7 +105,7 @@ class SelfTest(LaunchpadXMLRPCView):
def make_fault(self):
"""Returns an xmlrpc fault."""
- return xmlrpc_client.Fault(666, "Yoghurt and spanners.")
+ return xmlrpc.client.Fault(666, "Yoghurt and spanners.")
def concatenate(self, string1, string2):
"""Return the concatenation of the two given strings."""
diff --git a/lib/lp/xmlrpc/configure.zcml b/lib/lp/xmlrpc/configure.zcml
index d387eab..a0ed00d 100644
--- a/lib/lp/xmlrpc/configure.zcml
+++ b/lib/lp/xmlrpc/configure.zcml
@@ -87,148 +87,148 @@
/>
<class class="lp.xmlrpc.faults.BranchAlreadyRegistered">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.FileBugGotProductAndDistro">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class
class="lp.xmlrpc.faults.FileBugMissingProductOrDistribution"
>
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchDistribution">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchPackage">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchProduct">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchPerson">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchPersonWithName">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchBranch">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchBug">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.RequiredParameterMissing">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.BranchCreationForbidden">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.InvalidBranchUrl">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.BranchUniqueNameConflict">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchTeamMailingList">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.UnexpectedStatusReport">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.BadStatus">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoLinkedBranch">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchProductSeries">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.InvalidBranchIdentifier">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.BranchNameInUse">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.CannotHaveLinkedBranch">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.InvalidProductName">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NotInTeam">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.InvalidBranchName">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoBranchWithID">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoUrlForBranch">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.PathTranslationError">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.InvalidPath">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.PermissionDenied">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NotFound">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.InvalidBranchUniqueName">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchDistroSeries">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.NoSuchSourcePackageName">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.InvalidSourcePackageName">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
<class class="lp.xmlrpc.faults.Unauthorized">
- <require like_class="six.moves.xmlrpc_client.Fault" />
+ <require like_class="xmlrpc.client.Fault" />
</class>
</configure>
diff --git a/lib/lp/xmlrpc/helpers.py b/lib/lp/xmlrpc/helpers.py
index e990af9..f2c7397 100644
--- a/lib/lp/xmlrpc/helpers.py
+++ b/lib/lp/xmlrpc/helpers.py
@@ -7,7 +7,8 @@ __all__ = [
'return_fault',
]
-from six.moves.xmlrpc_client import Fault
+from xmlrpc.client import Fault
+
from twisted.python.util import mergeFunctionMetadata
diff --git a/lib/lp/xmlrpc/tests/test_private_xmlrpc.py b/lib/lp/xmlrpc/tests/test_private_xmlrpc.py
index c20d180..7215a23 100644
--- a/lib/lp/xmlrpc/tests/test_private_xmlrpc.py
+++ b/lib/lp/xmlrpc/tests/test_private_xmlrpc.py
@@ -4,7 +4,8 @@
"""Private XMLRPC tests.
"""
-from six.moves import xmlrpc_client
+import xmlrpc.client
+
from zope.component import getUtility
from lp.services.verification.interfaces.logintoken import ILoginTokenSet
@@ -30,14 +31,14 @@ class TestPrivateXMLRPC(TestCase):
private_root = 'http://xmlrpc-private.launchpad.test:8087/'
def get_public_proxy(self, path):
- """Get an xmlrpc_client.ServerProxy pointing at the public URL"""
- return xmlrpc_client.ServerProxy(
+ """Get an xmlrpc.client.ServerProxy pointing at the public URL"""
+ return xmlrpc.client.ServerProxy(
self.public_root + path,
transport=XMLRPCTestTransport())
def get_private_proxy(self, path):
- """Get an xmlrpc_client.ServerProxy pointing at the private URL"""
- return xmlrpc_client.ServerProxy(
+ """Get an xmlrpc.client.ServerProxy pointing at the private URL"""
+ return xmlrpc.client.ServerProxy(
self.private_root + path,
transport=XMLRPCTestTransport())
@@ -47,7 +48,7 @@ class TestPrivateXMLRPC(TestCase):
not available on the external XML-RPC port.
"""
external_api = self.get_public_proxy('mailinglists/')
- e = self.assertRaises(xmlrpc_client.ProtocolError,
+ e = self.assertRaises(xmlrpc.client.ProtocolError,
external_api.getPendingActions)
self.assertEqual(404, e.errcode)
@@ -77,7 +78,7 @@ class TestPrivateXMLRPC(TestCase):
internal_api = self.get_private_proxy('bugs/')
bug_dict = dict(
product='firefox', summary='the summary', comment='the comment')
- e = self.assertRaises(xmlrpc_client.ProtocolError,
+ e = self.assertRaises(xmlrpc.client.ProtocolError,
internal_api.filebug, bug_dict)
self.assertEqual(404, e.errcode)
diff --git a/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py b/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py
index 4c005eb..9f0d528 100644
--- a/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py
+++ b/lib/lp/xmlrpc/tests/test_xmlrpc_selftest.py
@@ -4,7 +4,8 @@
"""XMLRPC self-test api.
"""
-from six.moves import xmlrpc_client
+import xmlrpc.client
+
from zope.component import getUtility
from lp.services.webapp.interfaces import ILaunchBag
@@ -27,11 +28,11 @@ class TestXMLRPCSelfTest(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def make_proxy(self):
- return xmlrpc_client.ServerProxy(
+ return xmlrpc.client.ServerProxy(
'http://xmlrpc.launchpad.test/', transport=XMLRPCTestTransport())
def make_logged_in_proxy(self):
- return xmlrpc_client.ServerProxy(
+ return xmlrpc.client.ServerProxy(
'http://test@xxxxxxxxxxxxx:test@xxxxxxxxxxxxxxxxxxxxx/',
transport=XMLRPCTestTransport())
@@ -46,17 +47,17 @@ class TestXMLRPCSelfTest(TestCaseWithFactory):
self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault))
def test_custom_transport(self):
- """We can test our XMLRPC APIs using xmlrpc_client, using a custom
+ """We can test our XMLRPC APIs using xmlrpc.client, using a custom
Transport which talks with the publisher directly.
"""
selftest = self.make_proxy()
self.assertEqual('foo bar', selftest.concatenate('foo', 'bar'))
- fault = self.assertRaises(xmlrpc_client.Fault, selftest.make_fault)
+ fault = self.assertRaises(xmlrpc.client.Fault, selftest.make_fault)
self.assertEqual("<Fault 666: 'Yoghurt and spanners.'>", str(fault))
def test_unexpected_exception(self):
"""Sometimes an XML-RPC method will be buggy, and raise an exception
- other than xmlrpc_client.Fault. We have such a method on the self
+ other than xmlrpc.client.Fault. We have such a method on the self
test view.
"""
selftestview = SelfTest('somecontext', 'somerequest')
@@ -69,7 +70,7 @@ class TestXMLRPCSelfTest(TestCaseWithFactory):
one was generated):
"""
selftest = self.make_proxy()
- e = self.assertRaises(xmlrpc_client.Fault, selftest.raise_exception)
+ e = self.assertRaises(xmlrpc.client.Fault, selftest.raise_exception)
self.assertStartsWith(str(e), "<Fault -1: 'OOPS-")
def test_anonymous_authentication(self):
Follow ups