Name customization for attribute_of

瘦欲@ 提交于 2019-12-12 00:09:01

问题


I'm playing with attribute_of and spyne 2.10 (very glad it's out). Let's consider following model:

class Product(ComplexModel):
    id = complex.XmlAttribute(primitive.Uuid)
    edition = primitive.Unicode
    edition_id = complex.XmlAttribute(primitive.Uuid, attribute_of='edition')

That gives results like:

<product id="00000000-0000-0000-0000-000000000000">
    <edition edition_id="00000000-0000-0000-0000-000000000000">My edition</edition>
</product>

How to customize edition_id's name for results like <edition id="..."/>?


回答1:


As of 2.10, Spyne does not support this.

I can't think of an easy workaround as it'd require writing method_call and method_return_document events as well as wsdl events to patch the wsdl manually.

However, if you can write tests for it, I'll see what I can do for the 2.11.



来源:https://stackoverflow.com/questions/16187055/name-customization-for-attribute-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!