[SQLObject] Default datetime when creating a record.
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Alex Le D. <al...@ps...> - 2005-11-17 02:03:14
|
I have the following table defined. When a new record is created I would
have expected that the DateTime field be set to when the record is
created. I am using SQLite in a cherrypy application and when a user
does something I log some information.
However what I am observing is that the DateTime appears to be always
the start time of the cherrypy server. I think this might be more of a
python/cherrypy question than a SQLObject question. If so, I apologise.
My feeling is that datetime.now() is evaluated when the class is
"loaded" rather than when the record object is created. Is that right?
class MyLog (SQLObject) :
""" Any change to the system is tracked.
"""
dbDateTime = DateTimeCol(default=datetime.now())
dbDescription = StringCol(default='')
cheers, Alex.
--
|