Fix a suds.client.Client to-string conversion bug.

Changed the way suds.client.Client to-string conversion outputs build info. This
fixes a bug in the original '0.4.1 jurko 1' forked project release causing
printing out a suds.client.Client object to raise an exception due to the code
in question making some undocumented assumptions on how the build information
string should be formatted. Added a related test. Updated todo list.
This commit is contained in:
Jurko Gospodnetić 2011-12-24 23:43:23 +01:00
parent cb0941342c
commit 61e9ec70eb
3 changed files with 79 additions and 59 deletions

128
TODO.txt
View File

@ -116,68 +116,82 @@ PRIORETIZED:
(+) * Upload the source package.
(+) * Project site.
(+) * PyPI.
(+) * (Jurko) Fix getting a suds.client object's string representation when the
(+) client is initialized with the following WSDL. Calling 'str(client)'
(+) reports 'IndexError: list index out of range'.
(+) * WSDL.
(+) <?xml version='1.0' encoding='UTF-8'?>
(+) <wsdl:definitions targetNamespace="my-namespace"
(+) xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
(+) xmlns:ns="my-namespace"
(+) xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
(+) <wsdl:types>
(+) <xsd:schema targetNamespace="my-namespace"
(+) elementFormDefault="qualified"
(+) attributeFormDefault="unqualified"
(+) xmlns:xsd="http://www.w3.org/2001/XMLSchema">
(+) <xsd:element name="Elemento">
(+) <xsd:complexType>
(+) <xsd:sequence>
(+) <xsd:element name="x1" type="xsd:string" />
(+) <xsd:element name="x2">
(+) <xsd:complexType>
(+) <xsd:choice>
(+) <xsd:element name="u1" type="xsd:string" />
(+) <xsd:element name="u2" type="xsd:string" />
(+) <xsd:element name="u3" type="xsd:string" />
(+) </xsd:choice>
(+) </xsd:complexType>
(+) </xsd:element>
(+) <xsd:element name="x3" type="xsd:string" />
(+) </xsd:sequence>
(+) </xsd:complexType>
(+) </xsd:element>
(+) </xsd:schema>
(+) </wsdl:types>
(+) <wsdl:message name="fRequestMessage">
(+) <wsdl:part name="parameters" element="ns:Elemento" />
(+) </wsdl:message>
(+) <wsdl:portType name="dummyPortType">
(+) <wsdl:operation name="f">
(+) <wsdl:input message="ns:fRequestMessage" />
(+) </wsdl:operation>
(+) </wsdl:portType>
(+) <wsdl:binding name="dummy" type="ns:dummyPortType">
(+) <soap:binding style="document"
(+) transport="http://schemas.xmlsoap.org/soap/http" />
(+) <wsdl:operation name="f">
(+) <soap:operation soapAction="f" style="document" />
(+) <wsdl:input><soap:body use="literal" /></wsdl:input>
(+) <wsdl:output><soap:body use="literal" /></wsdl:output>
(+) </wsdl:operation>
(+) </wsdl:binding>
(+) <wsdl:service name="dummy">
(+) <wsdl:port name="dummy" binding="ns:dummy">
(+) <soap:address location="https://localhost/dummy" />
(+) </wsdl:port>
(+) </wsdl:service>
(+) </wsdl:definitions>
(+) * Research.
(+) * Caused by undocumented suds.client.Client behaviour - it was
(+) expecting a specifically formatted suds.__build__ string which was
(+) not the case with the forked project release.
(+) * Add a test.
(+) * Fix.
(+) * Plan preparing a patched release.
* (Jurko) Prepare the '0.4.1 jurko 2' release.
* Update release notes.
* Follow the documented release procedure.
* Update version information.
* Tag in Hg.
* Upload the source package.
* Project site.
* PyPI.
NON PRIORETIZED:
=================================================
* Fix getting a suds.client object's string representation when the client
is initialized with the following WSDL. Calling 'str(client)' reports
'IndexError: list index out of range'.
* WSDL.
<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions targetNamespace="my-namespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns="my-namespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xsd:schema targetNamespace="my-namespace"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Elemento">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="x1" type="xsd:string" />
<xsd:element name="x2">
<xsd:complexType>
<xsd:choice>
<xsd:element name="u1" type="xsd:string" />
<xsd:element name="u2" type="xsd:string" />
<xsd:element name="u3" type="xsd:string" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="x3" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="fRequestMessage">
<wsdl:part name="parameters" element="ns:Elemento" />
</wsdl:message>
<wsdl:portType name="dummyPortType">
<wsdl:operation name="f">
<wsdl:input message="ns:fRequestMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="dummy" type="ns:dummyPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="f">
<soap:operation soapAction="f" style="document" />
<wsdl:input><soap:body use="literal" /></wsdl:input>
<wsdl:output><soap:body use="literal" /></wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="dummy">
<wsdl:port name="dummy" binding="ns:dummy">
<soap:address location="https://localhost/dummy" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
* Make it simpler to run Py3 tests.
* There should be no need for installing suds to a global location
similar to how this is not needed when running Py2 tests.

View File

@ -189,10 +189,10 @@ class Client(UnicodeMixin):
def __unicode__(self):
s = ['\n']
build = suds.__build__.split()
s.append('Suds ( https://fedorahosted.org/suds/ )')
s.append(' version: %s' % suds.__version__)
s.append(' %s build: %s' % (build[0], build[1]))
if ( suds.__build__ ):
s.append(' build: %s' % suds.__build__)
for sd in self.sd:
s.append('\n\n%s' % unicode(sd))
return ''.join(s)

View File

@ -44,6 +44,12 @@ import suds.store
import xml.sax
def test_converting_client_to_a_string_must_not_raise_an_exception():
client = _client_from_wsdl(
"<?xml version='1.0' encoding='UTF-8'?><root />")
str(client)
def test_empty_invalid_wsdl():
try:
client = _client_from_wsdl("")