Andrii,

Actually, that test does not seem right for either Python 2 or 3.
Maybe we be converting the year to an int.  What should our internal
representation be, I wonder?

I'll take a look.

By the way, I do my development and testing with Python 3 (from the
Anaconda distribution).  And, I try to remember to run tests with
Python 2.

Thanks for reporting this and for providing the snippet of the
schema etc.

Dave

On Mon, May 13, 2019 at 03:18:11PM +0100, Andrii Iudin wrote:
> 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

-- 

Dave Kuhlman
http://www.davekuhlman.org


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

Reply via email to