Hi,
we are working with this patch to solve the problem with using float as
base type in the validations.

The problem is that this patch will return a Decimal type and some
operations aren't allowed like multiplication.

Cheers,

-- 
Eduard Carreras i Nadal <[email protected]>
GISCE ENGINYERIA S.L.
--- pyxb/binding/datatypes.py	2010-01-28 16:39:33.000000000 +0100
+++ pyxb-decimal/binding/datatypes.py	2010-05-28 18:38:52.000000000 +0200
@@ -49,6 +49,7 @@
 import pyxb.utils.utility as utility
 import basis
 import re
+import decimal as base_decimal
 
 _PrimitiveDatatypes = []
 _DerivedDatatypes = []
@@ -122,7 +123,7 @@
 
 _PrimitiveDatatypes.append(boolean)
 
-class decimal (basis.simpleTypeDefinition, types.FloatType):
+class decimal (basis.simpleTypeDefinition, base_decimal.Decimal):
     """decimal.
     
     U{http://www.w3.org/TR/xmlschema-2/#decimal}
@@ -138,6 +139,10 @@
     def XsdLiteral (cls, value):
         return '%s' % (value,)
 
+    def __new__ (cls, *args, **kw):
+        args = tuple(map(str, args))
+        return super(decimal, cls).__new__(cls, *args, **kw)
+
 _PrimitiveDatatypes.append(decimal)
 
 class float (basis.simpleTypeDefinition, types.FloatType):
------------------------------------------------------------------------------

_______________________________________________
pyxb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyxb-users

Reply via email to