Hello All,
I have an application where I need store the difference in time
between two events. Unfortunately the datastore only supports storing
'time' as a datetime.datetime object.
In an attempt to circumvent this constraint, I am adding the interval
to the smallest possible datetime.datetime object and saving to the
datastore, then doing the reverse when recalling the interval.
Before I implement this I though I would check to see that I wasn't
reinventing the wheel.
Does anyone know if there a better way to do this?
Will datetime.min will ever change?
I am stupidly creating a CPU intensive process?
All comments/suggestions most appreciated.
Thanks,
David
For example:
Model:
class Item(db.Model):
interval = db.DateTimeProperty()
To save the interval :
days = int(self.request.get("days"))
hours = int(self.request.get("hours"))
minutes = int(self.request.get("minutes")
Item = db.Item()
delay = timedelta(days = days, hours = hours, minutes = minutes)
Item.interval = datetime.min + delay
Item.put()
To recall the interval:
Item = db.Item.get(key)
delay = Item.interval - datetime.min
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" 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/google-appengine?hl=en.