From 6444deb7b636943f30fb7c9ac79917ccb9e96144 Mon Sep 17 00:00:00 2001 From: Ionut Turturica Date: Wed, 20 Jun 2012 16:20:13 -0700 Subject: [PATCH 1/3] Cut off fpconst dependency. --- CHANGES.txt | 2 +- README.txt | 2 -- setup.py | 1 - src/SOAPpy/Parser.py | 13 ++++++------- src/SOAPpy/SOAPBuilder.py | 7 +++---- src/SOAPpy/Types.py | 4 ++++ 6 files changed, 14 insertions(+), 15 deletions(-) mode change 100755 => 100644 src/SOAPpy/SOAPBuilder.py diff --git a/CHANGES.txt b/CHANGES.txt index 0eeab65..51b1223 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -3,7 +3,7 @@ CHANGELOG 0.12.6 (unreleased) -------------------- -- Nothing changed yet +- Remove dependency on fpconst. 0.12.5 (2011-08-01) ------------------- diff --git a/README.txt b/README.txt index 13d8472..e20c051 100644 --- a/README.txt +++ b/README.txt @@ -122,8 +122,6 @@ USING GITHUB REQUIRED PACKAGES ------------------ - - fpconst 0.6.0 or later, - - wstools diff --git a/setup.py b/setup.py index e0bf13f..7003fe0 100644 --- a/setup.py +++ b/setup.py @@ -66,7 +66,6 @@ setup( package_dir = {'': 'src'}, include_package_data=True, install_requires=[ - 'fpconst', 'wstools', ] ) diff --git a/src/SOAPpy/Parser.py b/src/SOAPpy/Parser.py index 93da26e..a3127f2 100644 --- a/src/SOAPpy/Parser.py +++ b/src/SOAPpy/Parser.py @@ -5,7 +5,6 @@ from NS import NS from Utilities import * import string -import fpconst import xml.sax from wstools.XMLname import fromXMLname @@ -909,22 +908,22 @@ class SOAPParser(xml.sax.handler.ContentHandler): # Explicitly check for NaN and Infinities if s == "nan": - d = fpconst.NaN + d = NaN elif s[0:2]=="inf" or s[0:3]=="+inf": - d = fpconst.PosInf + d = PosInf elif s[0:3] == "-inf": - d = fpconst.NegInf + d = NegInf else : d = float(s) if config.strict_range: - if fpconst.isNaN(d): + if NaN == d: if s[0:2] != 'nan': raise ValueError, "invalid %s: %s" % (t[1], s) - elif fpconst.isNegInf(d): + elif NegInf == d: if s[0:3] != '-inf': raise UnderflowError, "%s too small: %s" % (t[1], s) - elif fpconst.isPosInf(d): + elif PosInf == d: if s[0:2] != 'inf' and s[0:3] != '+inf': raise OverflowError, "%s too large: %s" % (t[1], s) elif d < 0 and d < l[1]: diff --git a/src/SOAPpy/SOAPBuilder.py b/src/SOAPpy/SOAPBuilder.py old mode 100755 new mode 100644 index f2eaee2..baccb91 --- a/src/SOAPpy/SOAPBuilder.py +++ b/src/SOAPpy/SOAPBuilder.py @@ -38,7 +38,6 @@ from version import __version__ import cgi from wstools.XMLname import toXMLname, fromXMLname -import fpconst # SOAPpy modules from Config import Config @@ -330,11 +329,11 @@ class SOAPBuilder: if Config.strict_range: doubleType(obj) - if fpconst.isPosInf(obj): + if PosInf == obj: obj = "INF" - elif fpconst.isNegInf(obj): + elif NegInf == obj: obj = "-INF" - elif fpconst.isNaN(obj): + elif NaN == obj: obj = "NaN" else: obj = repr(obj) diff --git a/src/SOAPpy/Types.py b/src/SOAPpy/Types.py index 8cfee53..92838aa 100644 --- a/src/SOAPpy/Types.py +++ b/src/SOAPpy/Types.py @@ -53,6 +53,10 @@ from NS import NS from Utilities import encodeHexString, cleanDate from Config import Config +NaN = float('NaN') +PosInf = float('Inf') +NegInf = -PosInf + ############################################################################### # Utility functions ############################################################################### From 986c2df7916b4ce5442cae35b98648695aede9ba Mon Sep 17 00:00:00 2001 From: Ionut Turturica Date: Sat, 23 Feb 2013 13:07:19 -0800 Subject: [PATCH 2/3] In some odd cases HTTPResponse returns None instead of a file handle. Raise HTTPError when that happens. --- src/SOAPpy/Client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SOAPpy/Client.py b/src/SOAPpy/Client.py index 3749879..8662989 100644 --- a/src/SOAPpy/Client.py +++ b/src/SOAPpy/Client.py @@ -280,13 +280,17 @@ class HTTPTransport: except: message_len = -1 + f = r.getfile() + if f is None: + raise HTTPError(code, "Empty response from server\nCode: %s\nHeaders: %s" % (msg, headers)) + if message_len < 0: # Content-Length missing or invalid; just read the whole socket # This won't work with HTTP/1.1 chunked encoding - data = r.getfile().read() + data = f.read() message_len = len(data) else: - data = r.getfile().read(message_len) + data = f.read(message_len) if(config.debug): print "code=",code From ee490610a75d562c2b68434d959a6a77ef70d76b Mon Sep 17 00:00:00 2001 From: Ionut Turturica Date: Fri, 4 Apr 2014 18:06:18 -0700 Subject: [PATCH 3/3] Support / (and other reserved characters) in the password. --- src/SOAPpy/Client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SOAPpy/Client.py b/src/SOAPpy/Client.py index 8662989..5515ef6 100644 --- a/src/SOAPpy/Client.py +++ b/src/SOAPpy/Client.py @@ -220,7 +220,7 @@ class HTTPTransport: # if user is not a user:passwd format # we'll receive a failure from the server. . .I guess (??) if addr.user != None: - val = base64.encodestring(addr.user) + val = base64.encodestring(urllib.unquote_plus(addr.user)) r.putheader('Authorization','Basic ' + val.replace('\012','')) # This fixes sending either "" or "None"