Fix returning objects with object attributes set to 'None'
This commit is contained in:
parent
9cb0b58db6
commit
d05fb583eb
@ -45,6 +45,8 @@ def tojson(datatype, value):
|
|||||||
def myspecialtype_tojson(datatype, value):
|
def myspecialtype_tojson(datatype, value):
|
||||||
return str(value)
|
return str(value)
|
||||||
"""
|
"""
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
if wsme.types.iscomplex(datatype):
|
if wsme.types.iscomplex(datatype):
|
||||||
d = dict()
|
d = dict()
|
||||||
for attr in wsme.types.list_attributes(datatype):
|
for attr in wsme.types.list_attributes(datatype):
|
||||||
|
@ -574,6 +574,15 @@ class ProtocolTestCase(unittest.TestCase):
|
|||||||
_rt=NestedOuter)
|
_rt=NestedOuter)
|
||||||
self.assertEquals(r, value)
|
self.assertEquals(r, value)
|
||||||
|
|
||||||
|
def test_setnested_nullobj(self):
|
||||||
|
value = {'inner': None}
|
||||||
|
r = self.call(
|
||||||
|
'argtypes/setnested',
|
||||||
|
value=(value, NestedOuter),
|
||||||
|
_rt=NestedOuter
|
||||||
|
)
|
||||||
|
self.assertEquals(r, value)
|
||||||
|
|
||||||
def test_setbytesarray(self):
|
def test_setbytesarray(self):
|
||||||
value = [b("1"), b("2"), b("three")]
|
value = [b("1"), b("2"), b("three")]
|
||||||
r = self.call('argtypes/setbytesarray',
|
r = self.call('argtypes/setbytesarray',
|
||||||
|
@ -47,6 +47,8 @@ def prepare_value(value, datatype):
|
|||||||
|
|
||||||
def prepare_result(value, datatype):
|
def prepare_result(value, datatype):
|
||||||
print(value, datatype)
|
print(value, datatype)
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
if datatype == wsme.types.binary:
|
if datatype == wsme.types.binary:
|
||||||
return base64.decodestring(value.encode('ascii'))
|
return base64.decodestring(value.encode('ascii'))
|
||||||
if isusertype(datatype):
|
if isusertype(datatype):
|
||||||
|
@ -172,6 +172,8 @@ def tosuds(client, value):
|
|||||||
value, datatype = value
|
value, datatype = value
|
||||||
else:
|
else:
|
||||||
datatype = type(value)
|
datatype = type(value)
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
if isinstance(datatype, list):
|
if isinstance(datatype, list):
|
||||||
if datatype[0] in array_types:
|
if datatype[0] in array_types:
|
||||||
tname = array_types[datatype[0]]
|
tname = array_types[datatype[0]]
|
||||||
@ -416,3 +418,6 @@ class TestSOAP(wsme.tests.protocol.ProtocolTestCase):
|
|||||||
|
|
||||||
def test_return_objectdictattribute(self):
|
def test_return_objectdictattribute(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def test_setnested_nullobj(self):
|
||||||
|
pass # TODO write a soap adapted version of this test.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user