diff options
author | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
commit | ce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch) | |
tree | 05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/xmlrpclib.py | |
parent | 8b3febef2f96c35e9aad9db2ef499db040fdefae (diff) | |
download | cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.zip cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.gz cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.bz2 |
Raise statement normalization in Lib/.
Diffstat (limited to 'Lib/xmlrpclib.py')
-rw-r--r-- | Lib/xmlrpclib.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py index ac36b62..60b05b9 100644 --- a/Lib/xmlrpclib.py +++ b/Lib/xmlrpclib.py @@ -570,13 +570,13 @@ class Marshaller: try: value.__dict__ except: - raise TypeError, "cannot marshal %s objects" % type(value) + raise TypeError("cannot marshal %s objects" % type(value)) # check if this class is a sub-class of a basic type, # because we don't know how to marshal these types # (e.g. a string sub-class) for type_ in type(value).__mro__: if type_ in self.dispatch.keys(): - raise TypeError, "cannot marshal %s objects" % type(value) + raise TypeError("cannot marshal %s objects" % type(value)) # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix # for the p3yk merge, this should probably be fixed more neatly. f = self.dispatch["_arbitrary_instance"] @@ -584,14 +584,14 @@ class Marshaller: def dump_nil (self, value, write): if not self.allow_none: - raise TypeError, "cannot marshal None unless allow_none is enabled" + raise TypeError("cannot marshal None unless allow_none is enabled") write("<value><nil/></value>") dispatch[type(None)] = dump_nil def dump_int(self, value, write): # in case ints are > 32 bits if value > MAXINT or value < MININT: - raise OverflowError, "int exceeds XML-RPC limits" + raise OverflowError("int exceeds XML-RPC limits") write("<value><int>") write(str(value)) write("</int></value>\n") @@ -606,7 +606,7 @@ class Marshaller: def dump_long(self, value, write): if value > MAXINT or value < MININT: - raise OverflowError, "long int exceeds XML-RPC limits" + raise OverflowError("long int exceeds XML-RPC limits") write("<value><int>") write(str(int(value))) write("</int></value>\n") @@ -633,7 +633,7 @@ class Marshaller: def dump_array(self, value, write): i = id(value) if i in self.memo: - raise TypeError, "cannot marshal recursive sequences" + raise TypeError("cannot marshal recursive sequences") self.memo[i] = None dump = self.__dump write("<value><array><data>\n") @@ -647,14 +647,14 @@ class Marshaller: def dump_struct(self, value, write, escape=escape): i = id(value) if i in self.memo: - raise TypeError, "cannot marshal recursive dictionaries" + raise TypeError("cannot marshal recursive dictionaries") self.memo[i] = None dump = self.__dump write("<value><struct>\n") for k, v in value.items(): write("<member>\n") if not isinstance(k, basestring): - raise TypeError, "dictionary key must be string" + raise TypeError("dictionary key must be string") write("<name>%s</name>\n" % escape(k)) dump(v, write) write("</member>\n") @@ -724,7 +724,7 @@ class Unmarshaller: self.append = self._stack.append self._use_datetime = use_datetime if use_datetime and not datetime: - raise ValueError, "the datetime module is not available" + raise ValueError("the datetime module is not available") def close(self): # return response tuple and target method @@ -791,7 +791,7 @@ class Unmarshaller: elif data == "1": self.append(True) else: - raise TypeError, "bad boolean value" + raise TypeError("bad boolean value") self._value = 0 dispatch["boolean"] = end_boolean @@ -897,8 +897,7 @@ class MultiCallIterator: elif type(item) == type([]): return item[0] else: - raise ValueError,\ - "unexpected type in multicall result" + raise ValueError("unexpected type in multicall result") class MultiCall: """server -> a object used to boxcar method calls @@ -952,7 +951,7 @@ def getparser(use_datetime=0): to an unmarshalling object. Return both objects. """ if use_datetime and not datetime: - raise ValueError, "the datetime module is not available" + raise ValueError("the datetime module is not available") if FastParser and FastUnmarshaller: if use_datetime: mkdatetime = _datetime_type @@ -1321,7 +1320,7 @@ class ServerProxy: import urllib type, uri = urllib.splittype(uri) if type not in ("http", "https"): - raise IOError, "unsupported XML-RPC protocol" + raise IOError("unsupported XML-RPC protocol") self.__host, self.__handler = urllib.splithost(uri) if not self.__handler: self.__handler = "/RPC2" |