本文整理汇总了Python中spyne.interface.xml_schema.XmlSchema.build_validation_schema方法的典型用法代码示例。如果您正苦于以下问题:Python XmlSchema.build_validation_schema方法的具体用法?Python XmlSchema.build_validation_schema怎么用?Python XmlSchema.build_validation_schema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyne.interface.xml_schema.XmlSchema
的用法示例。
在下文中一共展示了XmlSchema.build_validation_schema方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_xml_data_test_schema
# 需要导入模块: from spyne.interface.xml_schema import XmlSchema [as 别名]
# 或者: from spyne.interface.xml_schema.XmlSchema import build_validation_schema [as 别名]
def _build_xml_data_test_schema(self, custom_root):
tns = 'kickass.ns'
class ProductEdition(ComplexModel):
__namespace__ = tns
id = XmlAttribute(Uuid)
if custom_root:
name = XmlData(Uuid)
else:
name = XmlData(Unicode)
class Product(ComplexModel):
__namespace__ = tns
id = XmlAttribute(Uuid)
edition = ProductEdition
class ExampleService(ServiceBase):
@rpc(Product, _returns=Product)
def say_my_uuid(ctx, product):
pass
app = Application([ExampleService],
tns='kickass.ns',
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11()
)
schema = XmlSchema(app.interface)
schema.build_interface_document()
schema.build_validation_schema()
doc = schema.get_interface_document()['tns']
print(etree.tostring(doc, pretty_print=True))
return schema
示例2: set_app
# 需要导入模块: from spyne.interface.xml_schema import XmlSchema [as 别名]
# 或者: from spyne.interface.xml_schema.XmlSchema import build_validation_schema [as 别名]
def set_app(self, value):
ProtocolBase.set_app(self, value)
self.validation_schema = None
if value:
from spyne.interface.xml_schema import XmlSchema
xml_schema = XmlSchema(value.interface)
xml_schema.build_validation_schema()
self.validation_schema = xml_schema.validation_schema
示例3: get_validation_schema
# 需要导入模块: from spyne.interface.xml_schema import XmlSchema [as 别名]
# 或者: from spyne.interface.xml_schema.XmlSchema import build_validation_schema [as 别名]
def get_validation_schema(models, default_namespace=None):
"""Returns the validation schema object for the given models.
:param models: A list of spyne.model classes that will be represented in
the schema.
"""
if default_namespace is None:
default_namespace = models[0].get_namespace()
fake_app = FakeApplication(default_namespace)
interface = Interface(fake_app)
for m in models:
m.resolve_namespace(m, default_namespace)
interface.add_class(m)
schema = XmlSchema(interface)
schema.build_validation_schema()
return schema.validation_schema
示例4: get_validation_schema
# 需要导入模块: from spyne.interface.xml_schema import XmlSchema [as 别名]
# 或者: from spyne.interface.xml_schema.XmlSchema import build_validation_schema [as 别名]
def get_validation_schema(models, default_namespace=None):
'''Returns the validation schema object for the given models.
:param models: A list of spyne.model classes that will be represented in
the schema.
'''
if default_namespace is None:
default_namespace = models[0].get_namespace()
fake_app = FakeApplication()
fake_app.tns = default_namespace
fake_app.services = []
interface = Interface(fake_app)
for m in models:
interface.add_class(m)
schema = XmlSchema(interface)
schema.build_validation_schema()
return schema.validation_schema