summaryrefslogtreecommitdiff
path: root/Lib/xmlrpc/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/xmlrpc/client.py')
-rw-r--r--Lib/xmlrpc/client.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py
index 50cedfc4bb..dbd9143bc4 100644
--- a/Lib/xmlrpc/client.py
+++ b/Lib/xmlrpc/client.py
@@ -207,8 +207,8 @@ class ProtocolError(Error):
self.headers = headers
def __repr__(self):
return (
- "<ProtocolError for %s: %s %s>" %
- (self.url, self.errcode, self.errmsg)
+ "<%s for %s: %s %s>" %
+ (self.__class__.__name__, self.url, self.errcode, self.errmsg)
)
##
@@ -236,7 +236,8 @@ class Fault(Error):
self.faultCode = faultCode
self.faultString = faultString
def __repr__(self):
- return "<Fault %s: %r>" % (self.faultCode, self.faultString)
+ return "<%s %s: %r>" % (self.__class__.__name__,
+ self.faultCode, self.faultString)
# --------------------------------------------------------------------
# Special values
@@ -354,7 +355,7 @@ class DateTime:
return self.value
def __repr__(self):
- return "<DateTime %r at %x>" % (self.value, id(self))
+ return "<%s %r at %#x>" % (self.__class__.__name__, self.value, id(self))
def decode(self, data):
self.value = str(data).strip()
@@ -846,7 +847,7 @@ class MultiCall:
self.__call_list = []
def __repr__(self):
- return "<MultiCall at %x>" % id(self)
+ return "<%s at %#x>" % (self.__class__.__name__, id(self))
__str__ = __repr__
@@ -1435,8 +1436,8 @@ class ServerProxy:
def __repr__(self):
return (
- "<ServerProxy for %s%s>" %
- (self.__host, self.__handler)
+ "<%s for %s%s>" %
+ (self.__class__.__name__, self.__host, self.__handler)
)
__str__ = __repr__
@@ -1458,6 +1459,12 @@ class ServerProxy:
return self.__transport
raise AttributeError("Attribute %r not found" % (attr,))
+ def __enter__(self):
+ return self
+
+ def __exit__(self, *args):
+ self.__close()
+
# compatibility
Server = ServerProxy