I have to implement a service with spyne that exposes a specific wsdl
right now I'm unable to replicate this definition:
<xs:complexType name="MyType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="version" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
So far the best I was able to achieve is
class MyType(ComplexModel):
__namespace__ = "uri:my-ns"
__extends__ = primitive.Unicode
version = XmlAttribute(primitive.Unicode)
that raise an AttributeError
but if I "patch" models/complex.py
[1] I obtain:
<xs:complexType name="MyType">
<xs:complexContent>
<xs:extension base="xs:string">
<xs:attribute name="version " type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
almost there! but my complexType has a complexContent
instead of a simpleContent
[1] I'm using the master branch of spyne (0f587b2d606b54e41fc5cc3d33b51cc3b324a2ca) and if I add __extends__ = primitive.Unicode
I need to change line 602 of model/complex.py
from:
if eattr._subclasses is None
to
if getattr(eattr, "_subclasses", None) is None