当前位置: 首页>>代码示例>>Python>>正文


Python XmlSchema.build_validation_schema方法代码示例

本文整理汇总了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
开发者ID:ashleysommer,项目名称:spyne,代码行数:36,代码来源:test_xml_schema.py

示例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
开发者ID:drowolath,项目名称:spyne,代码行数:14,代码来源:_base.py

示例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
开发者ID:plq,项目名称:spyne,代码行数:23,代码来源:xml.py

示例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
开发者ID:matafc,项目名称:spyne,代码行数:24,代码来源:xml.py


注:本文中的spyne.interface.xml_schema.XmlSchema.build_validation_schema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。