Here is what I'm trying to do: the user sends the time in the Pacific, after submitting, I use .replace to set the time zone for Pacific.
Pacific = time.USTimeZone(-8, "Pacific", "PST", "PDT") addEvent.date = addEvent.date.replace(tzinfo=Pacific)
As soon as I installed tzinfo, I bet. According to the python documentation for google appengine, it says:
"If the datetime value has the tzinfo attribute, it will be converted to the UTC time zone for storage. The values ββare returned from the UTC data store, with tzinfo from None. An application that needs date and time values ββin a specific time zone must correctly set tzinfo when updating values ββand convert the values ββto the time zone when accessing the value. "
However, when I do put (), I get the following error:
WARNING 2012-10-06 21:10: 14,579 tasklets.pyhaps99] initial generator _put_tasklet (context.py:264) raised by NotImplementedError (DatetimeProperty date can only support UTC. Get a new property to support alternative time zones.) WARNING 2012 -10-06 21:10: 14,579 tasklets.pyhaps99] paused put generator (context.py:703) raised by NotImplementedError (DatetimeProperty date can only support UTC. Get a new property to support alternative time zones.)
Please note that I am using NDB
So, after that, I suggested that perhaps NDB will not automatically convert it to UTC. So I tried to convert it to UTC using the following code:
class UTC(tzinfo): def utcoffset(self, dt): return timedelta(0) def tzname(self, dt): return str("UTC") def dst(self, dt): return timedelta(0)
and now I still get the same error, even after I convert peacetime to UTC and set the name tzinfo to "UTC".
Could really use a ton of help here ... thanks!