Dear Dave,

We are in a process of moving to Python 3 and have stumbled upon the following problem. We have a field defined as
<xs:element name="year" minOccurs="0">
    <xs:simpleType>
        <xs:restriction base="xs:gYear">
            <xs:minInclusive value="1900"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

The generated code for it is
def validate_yearType(self, value):
    # Validate type yearType, a restriction on xs:gYear.
    if value is not None and Validate_simpletypes_:
        if value < 1900:
            warnings_.warn('Value "%(value)s" does not match xsd minInclusive restriction on yearType' % {"value" : value} )

Which is fine in Python 2. However, when an XML file that contains
<year>2017</year>

is being processed in Python 3 the following error occurs:
File "path/empiar.py", line 3784, in validate_yearType1
  if value < 1900:
TypeError: '<' not supported between instances of 'str' and 'int'

Please could you advise on the way to solve this?

Many thanks and best regards,
Andrii


_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to