Fixed bug with decimal value string formatting
authorLaurent Bessard
Wed, 13 Nov 2013 23:25:26 +0100
changeset 1375 dc94c71a2f25
parent 1374 1eefc427419f
child 1376 f8acd48e0342
child 1384 02fe382c4511
Fixed bug with decimal value string formatting
xmlclass/xsdschema.py
--- a/xmlclass/xsdschema.py	Mon Nov 11 00:59:19 2013 +0100
+++ b/xmlclass/xsdschema.py	Wed Nov 13 23:25:26 2013 +0100
@@ -52,10 +52,12 @@
         if name is not None:
             ind1, ind2 = getIndent(indent, name)
             text += ind1 + "<%s>" % name
-        if value in extra_values or value % 1 != 0 or isinstance(value, IntType):
+        if isinstance(value, IntType):
+            text += str(value)
+        elif value in extra_values or value % 1 != 0:
             text += float_format(value)
         else:
-            text += "%.0f" % value
+            text += "{:.0f}".format(value)
         if name is not None:
             text += "</%s>\n" % name
         return text