自定义attribute_of的名称 [英] Name customization for attribute_of

查看:197
本文介绍了自定义attribute_of的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩attribute_of和spyne 2.10(非常高兴它出来了).让我们考虑以下模型:

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')

得出的结果如下:

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

如何为<edition id="..."/>之类的结果自定义edition_id的名称?

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

推荐答案

从2.10版开始,Spyne不支持此功能.

As of 2.10, Spyne does not support this.

我想不出简单的解决方法,因为它需要编写method_call和method_return_document事件以及wsdl事件来手动打补丁wsdl.

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.

但是,如果您可以为此编写测试,那么我会为2.11做些什么.

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

这篇关于自定义attribute_of的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆