I was surprised recently by the lack of range in DateCol. This field
type does not accept values prior to 1900. I cannot find any
documentation to the effect.
Not needing more than 1 second resolution I solved the problem by
converting to a float in days. I enclose the code below in case it is
of use to others.
class person(SQLobject):
..........
DOB = FloatCol(default = None, dbName='dob')
def _set_DOB(self, value):
if value : self._SO_set_DOB(dateToFloat(value))
def _get_DOB(self):
return dateFromFloat(self._SO_get_DOB())
def dateToFloat(date):
d = date-datetime.datetime.min
return d.days + d.seconds/86400.
def dateFromFloat(date):
if date :
return
datetime.datetime.min+datetime.timedelta(int(date),int((date%1)*86400))
else:
return None
Thanks for a great product.
Nigel King
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---