xmlclass/xmlclass.py
changeset 92 76d5001393df
parent 90 2245e8776086
child 116 58b9b84e385f
--- a/xmlclass/xmlclass.py	Thu Sep 13 09:46:51 2007 +0200
+++ b/xmlclass/xmlclass.py	Mon Sep 17 10:13:56 2007 +0200
@@ -29,13 +29,6 @@
 from new import classobj
 
 """
-Time and date definitions
-"""
-TimeType = time(0,0,0).__class__
-DateType = date(1,1,1).__class__
-DateTimeType = datetime(1,1,1,0,0,0).__class__
-
-"""
 Regular expression models for extracting dates and times from a string
 """
 time_model = re.compile('([0-9]{2}):([0-9]{2}):([0-9]{2}(?:.[0-9]*)?)')
@@ -376,9 +369,9 @@
                             time_values.extend([int(seconds), int((seconds % 1) * 1000000)])
                             return time(*time_values)
                         return time(0,0,0,0)
-                    return TimeType, GetTimeInitialValue
-                else:
-                    return TimeType, lambda:time(0,0,0,0)
+                    return time, GetTimeInitialValue
+                else:
+                    return time, lambda:time(0,0,0,0)
             elif type_compute == "date":
                 if default:
                     def GetDateInitialValue():
@@ -387,9 +380,9 @@
                             date_values = [int(v) for v in result.groups()]
                             return date(*date_values)
                         return date(1,1,1)
-                    return DateType, GetDateInitialValue
-                else:
-                    return DateType, lambda:date(1,1,1)
+                    return date, GetDateInitialValue
+                else:
+                    return date, lambda:date(1,1,1)
             elif type_compute == "dateTime":
                 if default:
                     def GetDateTimeInitialValue():
@@ -401,9 +394,9 @@
                             datetime_values.extend([int(seconds), int((seconds % 1) * 1000000)])
                             return datetime(*datetime_values)
                         return datetime(1,1,1,0,0,0,0)
-                    return DateTimeType, GetDateTimeInitialValue
-                else:
-                    return DateTimeType, lambda:datetime(1,1,1,0,0,0,0)
+                    return datetime, GetDateTimeInitialValue
+                else:
+                    return datetime, lambda:datetime(1,1,1,0,0,0,0)
             elif type_compute == "language":
                 if default:
                     def GetStringInitialValue():
@@ -505,7 +498,7 @@
                         value_type, initial = self.GetTypeInitialValue(members["basetype"])
                         if "min" in values:
                             initial = max(initial, values["min"])
-                        if "max" in values:
+                        elif "max" in values:
                             initial = min(initial, values["max"])
                         initialValues["value"] = GetInitialValueFunction(initial)
                         classmembers["value"] = initial