From eaa46bdd342f07902fbdeea8d15e0d5ff2f0572f Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Fri, 18 May 2012 11:58:25 +0200 Subject: [PATCH] Fix Unset attributes serialisation --- wsme/protocols/restxml.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wsme/protocols/restxml.py b/wsme/protocols/restxml.py index 88b0b6a..da1665f 100644 --- a/wsme/protocols/restxml.py +++ b/wsme/protocols/restxml.py @@ -58,8 +58,10 @@ def toxml(datatype, key, value): key, datatype.tobasetype(value)) elif wsme.types.iscomplex(datatype): for attrdef in datatype._wsme_attributes: - el.append(toxml(attrdef.datatype, attrdef.name, - getattr(value, attrdef.key))) + attrvalue = getattr(value, attrdef.key) + if attrvalue is not wsme.types.Unset: + el.append(toxml(attrdef.datatype, attrdef.name, + attrvalue)) else: el.text = six.text_type(value) return el