Fix Unset attributes serialisation

This commit is contained in:
Christophe de Vienne 2012-05-18 11:58:25 +02:00
parent 6ead929ca4
commit eaa46bdd34

View File

@ -58,8 +58,10 @@ def toxml(datatype, key, value):
key, datatype.tobasetype(value))
elif wsme.types.iscomplex(datatype):
for attrdef in datatype._wsme_attributes:
attrvalue = getattr(value, attrdef.key)
if attrvalue is not wsme.types.Unset:
el.append(toxml(attrdef.datatype, attrdef.name,
getattr(value, attrdef.key)))
attrvalue))
else:
el.text = six.text_type(value)
return el