From 3340b7b9d1ebaef724d9da4cba990cddf92a2c68 Mon Sep 17 00:00:00 2001 From: C Anthony Risinger Date: Tue, 12 Jun 2012 16:29:14 -0500 Subject: [PATCH] [issue #142] Members with nillable=false and maxOccurs=0 still set nillable Currently, when an element is optional, but NOT nillable, it's still set nillable during serialization. However, when nillable=true, the member is properly skipped. This behavior causes schema validation errors on the client. Example schema: [...] [...] Rpclib output: [...] 4fd7ad136b6b473006000005 [...] ... correct by not caring if nillable when deciding to skip or not. --- rpclib/protocol/xml/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpclib/protocol/xml/model.py b/rpclib/protocol/xml/model.py index 894c994a3..e378dc259 100644 --- a/rpclib/protocol/xml/model.py +++ b/rpclib/protocol/xml/model.py @@ -145,7 +145,7 @@ def get_members_etree(prot, cls, inst, parent): prot.to_parent_element(v, sv, cls.get_namespace(), parent, k) # Don't include empty values for non-nillable optional attributes. - elif subvalue is not None or (not v.Attributes.nillable or v.Attributes.min_occurs > 0): + elif subvalue is not None or v.Attributes.min_occurs > 0: prot.to_parent_element(v, subvalue, cls.get_namespace(), parent, k)