diff options
author | Guido van Rossum <guido@python.org> | 2007-06-07 23:15:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-06-07 23:15:56 (GMT) |
commit | 1325790b932c4bab4f8f94f5a36c09f4036ed9f8 (patch) | |
tree | 5f4c1d854783a4d082c5867094ec345f4772bf35 /Lib/xmlrpclib.py | |
parent | 7b955bd125951db694f19a1b8648b806b14bd61f (diff) | |
download | cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.zip cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.gz cpython-1325790b932c4bab4f8f94f5a36c09f4036ed9f8.tar.bz2 |
Merged revisions 55795-55816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines
Get rid of some remnants of classic classes. types.ClassType == type.
Also get rid of almost all uses of the types module and use the builtin name.
........
r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line
Remove a use of types, verify commit hook works
........
r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines
Fix syntax error introduced by Neal in last checkin.
........
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r-- | Lib/xmlrpclib.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py index 2b5ed6e..9a345ae 100644 --- a/Lib/xmlrpclib.py +++ b/Lib/xmlrpclib.py @@ -138,8 +138,6 @@ Exported functions: import re, time, operator -from types import * - # -------------------------------------------------------------------- # Internal stuff @@ -306,7 +304,7 @@ class DateTime: today = datetime.datetime.now().strftime("%Y%m%d") self.value = value.strftime(today+"T%H:%M:%S") return - if not isinstance(value, (TupleType, time.struct_time)): + if not isinstance(value, (tuple, time.struct_time)): if value == 0: value = time.time() value = time.localtime(value) @@ -580,7 +578,7 @@ class Marshaller: if not self.allow_none: raise TypeError, "cannot marshal None unless allow_none is enabled" write("<value><nil/></value>") - dispatch[NoneType] = dump_nil + dispatch[type(None)] = dump_nil def dump_int(self, value, write): # in case ints are > 32 bits @@ -589,7 +587,7 @@ class Marshaller: write("<value><int>") write(str(value)) write("</int></value>\n") - dispatch[IntType] = dump_int + #dispatch[int] = dump_int if _bool_is_builtin: def dump_bool(self, value, write): @@ -604,13 +602,13 @@ class Marshaller: write("<value><int>") write(str(int(value))) write("</int></value>\n") - dispatch[LongType] = dump_long + dispatch[int] = dump_long def dump_double(self, value, write): write("<value><double>") write(repr(value)) write("</double></value>\n") - dispatch[FloatType] = dump_double + dispatch[float] = dump_double def dump_string(self, value, write, escape=escape): write("<value><string>") @@ -636,8 +634,8 @@ class Marshaller: dump(v, write) write("</data></array></value>\n") del self.memo[i] - dispatch[TupleType] = dump_array - dispatch[ListType] = dump_array + dispatch[tuple] = dump_array + dispatch[list] = dump_array def dump_struct(self, value, write, escape=escape): i = id(value) @@ -657,7 +655,7 @@ class Marshaller: write("</member>\n") write("</struct></value>\n") del self.memo[i] - dispatch[DictType] = dump_struct + dispatch[dict] = dump_struct if datetime: def dump_datetime(self, value, write): @@ -1005,12 +1003,10 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None, where necessary. """ - assert isinstance(params, TupleType) or isinstance(params, Fault),\ - "argument must be tuple or Fault instance" - + assert isinstance(params, (tuple, Fault)), "argument must be tuple or Fault instance" if isinstance(params, Fault): methodresponse = 1 - elif methodresponse and isinstance(params, TupleType): + elif methodresponse and isinstance(params, tuple): assert len(params) == 1, "response tuple must be a singleton" if not encoding: @@ -1166,7 +1162,7 @@ class Transport: def get_host_info(self, host): x509 = {} - if isinstance(host, TupleType): + if isinstance(host, tuple): host, x509 = host import urllib @@ -1216,7 +1212,7 @@ class Transport: host, extra_headers, x509 = self.get_host_info(host) connection.putheader("Host", host) if extra_headers: - if isinstance(extra_headers, DictType): + if isinstance(extra_headers, dict): extra_headers = extra_headers.items() for key, value in extra_headers: connection.putheader(key, value) |