# HG changeset patch # User lbessard # Date 1189153640 -7200 # Node ID 4f1dbdb0bed26ea0870f062c59c8c1067f4ce101 # Parent fd17b0e0fd7e8372348bc66dab3febe980f838cc Bug on xmlclass XML file attributes generation fixed diff -r fd17b0e0fd7e -r 4f1dbdb0bed2 xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Tue Sep 04 17:12:48 2007 +0200 +++ b/xmlclass/xmlclass.py Fri Sep 07 10:27:20 2007 +0200 @@ -91,7 +91,10 @@ elif type_compute in ["unsignedLong","long","integer"]: return int(value) elif type_compute == "decimal": - return float(value) + computed_value = float(value) + if computed_value % 1 == 0: + return int(computed_value) + return computed_value elif type_compute in ["string","anyURI","NMTOKEN","language"]: return value elif type_compute == "time": @@ -740,9 +743,12 @@ return text elif values[1] == "attribute": value = getattr(self, attr, None) - if values[0].startswith("cls"): - value = value.getValue() - computed_value = ComputeValue(value) + if value != None: + if values[0].startswith("cls"): + value = value.getValue() + computed_value = ComputeValue(value) + else: + computed_value = None if values[2] != "optional" or value != computed_value: if len(bases) > 0: base_extras[attr] = value