summaryrefslogtreecommitdiffstats
path: root/Lib/xmlrpclib.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2003-04-24 19:51:31 (GMT)
committerSkip Montanaro <skip@pobox.com>2003-04-24 19:51:31 (GMT)
commitbfcbfa7c46fce54616b8b71ab27472da16759bf0 (patch)
tree072bdfa7fe44f0fb73d6d1d2ead48987844bdb5a /Lib/xmlrpclib.py
parentfa012610c443338da52080e9f05c839543e9b798 (diff)
downloadcpython-bfcbfa7c46fce54616b8b71ab27472da16759bf0.zip
cpython-bfcbfa7c46fce54616b8b71ab27472da16759bf0.tar.gz
cpython-bfcbfa7c46fce54616b8b71ab27472da16759bf0.tar.bz2
move imports in Binary class to top level to avoid repeated imports.
use cStringIO if available.
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r--Lib/xmlrpclib.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py
index 8c1ef1f..b6cd24b 100644
--- a/Lib/xmlrpclib.py
+++ b/Lib/xmlrpclib.py
@@ -386,6 +386,12 @@ def _datetime(data):
#
# @param data An 8-bit string containing arbitrary data.
+import base64
+try:
+ import cStringIO as StringIO
+except ImportError:
+ import StringIO
+
class Binary:
"""Wrapper for binary data."""
@@ -406,11 +412,9 @@ class Binary:
return cmp(self.data, other)
def decode(self, data):
- import base64
self.data = base64.decodestring(data)
def encode(self, out):
- import base64, StringIO
out.write("<value><base64>\n")
base64.encode(StringIO.StringIO(self.data), out)
out.write("</base64></value>\n")