Menu

#183 wsdl2py fails to generate pyclass

v2.0
closed-out-of-date
wstools (22)
5
2007-10-31
2006-11-23
O Ekanem
No

LISTING A
-------------
<types>
<xs:schema targetNamespace=" http://www.ekanem.de/2006/11/ " elementFormDefault="qualified">
<xs:element name="sortCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{2}[\-][0-9]{2}[\-][0-9]{2}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>
</types>

---------------
LISTING B
------------
<types>
<xs:schema targetNamespace="http://www.ekanem.de/2006/11/" elementFormDefault="qualified">
<xs:element name="sortCode" type="ex:SortCode"/>
<xs:simpleType name="SortCode">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{2}[\-][0-9]{2}[\-][0-9]{2}" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
</types>
--------------

wsdl2py fails to create a pyclass class for a schema constructed according to the pattern in LISTING A while it works fine for the construct in LISTING B.
patterns explained here
http://www.xfront.com/GlobalVersusLocal.html

see also http://sourceforge.net/mailarchive/forum.php?thread_id=31087797&forum_id=1729 for problem discussion.

Discussion

  • Joshua Boverhof

    Joshua Boverhof - 2007-10-31

    Logged In: YES
    user_id=711996
    Originator: NO

    This was fixed/broke at some unknown point

    sadam:~/Desktop/applewhite/share/testing/oekanem boverhof$ cat test.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ex="http://www.ekanem.de/2006/11/"
    targetNamespace="http://www.ekanem.de/2006/11/"
    elementFormDefault="qualified">

    <xs:element name="sortCode">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:pattern value="[0-9]{2}[\-][0-9]{2}[\-][0-9]{2}" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>

    <xs:element name="sortCode2" type="ex:SortCode"/>

    <xs:simpleType name="SortCode">
    <xs:restriction base="xs:string">
    <xs:pattern value="[0-9]{2}[\-][0-9]{2}[\-][0-9]{2}" />
    </xs:restriction>
    </xs:simpleType>
    </xs:schema>
    sadam:~/Desktop/applewhite/share/testing/oekanem boverhof$ cat test_xsd_types.py
    ##################################################
    # file: test_xsd_types.py
    #
    # schema types generated by "ZSI.generate.wsdl2python.WriteServiceModule"
    # /Library/Frameworks/Python.framework/Versions/Current/bin/wsdl2py -bx test.xsd
    #
    ##################################################

    import ZSI
    import ZSI.TCcompound
    from ZSI.schema import LocalElementDeclaration, ElementDeclaration, TypeDefinition, GTD, GED
    from ZSI.generate.pyclass import pyclass_type

    ##############################
    # targetNamespace
    # http://www.ekanem.de/2006/11/
    ##############################

    class ns0:
    targetNamespace = "http://www.ekanem.de/2006/11/"

    class SortCode_Def(ZSI.TC.String, TypeDefinition):
    schema = "http://www.ekanem.de/2006/11/"
    type = (schema, "SortCode")
    def __init__(self, pname, **kw):
    ZSI.TC.String.__init__(self, pname, pyclass=None, **kw)
    class Holder(str):
    typecode = self
    self.pyclass = Holder

    class sortCode_Dec(ZSI.TC.String, ElementDeclaration):
    literal = "sortCode"
    schema = "http://www.ekanem.de/2006/11/"
    def __init__(self, **kw):
    kw["pname"] = ("http://www.ekanem.de/2006/11/","sortCode")
    kw["aname"] = "_sortCode"
    ZSI.TC.String.__init__(self, **kw)
    class IHolder(str): typecode=self
    self.pyclass = IHolder
    IHolder.__name__ = "_sortCode_immutable_holder"

    class sortCode2_Dec(ElementDeclaration):
    literal = "sortCode2"
    schema = "http://www.ekanem.de/2006/11/"
    substitutionGroup = None
    def __init__(self, **kw):
    kw["pname"] = ("http://www.ekanem.de/2006/11/","sortCode2")
    kw["aname"] = "_sortCode2"
    if ns0.SortCode_Def not in ns0.sortCode2_Dec.__bases__:
    bases = list(ns0.sortCode2_Dec.__bases__)
    bases.insert(0, ns0.SortCode_Def)
    ns0.sortCode2_Dec.__bases__ = tuple(bases)

    ns0.SortCode_Def.__init__(self, **kw)
    if self.pyclass is not None: self.pyclass.__name__ = "sortCode2_Dec_Holder"

    # end class ns0 (tns: http://www.ekanem.de/2006/11/\)

     
  • Joshua Boverhof

    Joshua Boverhof - 2007-10-31
    • assigned_to: nobody --> boverhof
    • status: open --> closed-out-of-date
     

Log in to post a comment.