-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Also relates to #278.
It's not immediately clear how we should support this.
The fact that we support datetime.datetime
objects with timezones makes the seralize/deserialize operation potentially a function other than the identity.
For example
>>> from gcloud.datastore.datastore_v1_pb2 import Value
>>> value_pb = Value()
>>> import datetime
>>> import pytz
>>> timestamp = datetime.datetime.utcnow().replace(tzinfo=pytz.timezone('CET'))
>>> timestamp
datetime.datetime(2014, 10, 21, 23, 49, 31, 816554, tzinfo=<DstTzInfo 'CET' CET+1:00:00 STD>)
>>> from gcloud.datastore._helpers import _set_protobuf_value
>>> _set_protobuf_value(value_pb, timestamp)
>>> from gcloud.datastore._helpers import _get_value_from_value_pb
>>> _get_value_from_value_pb(value_pb)
datetime.datetime(2014, 10, 21, 22, 49, 31, 816554, tzinfo=<UTC>)
I realized this while doing a before/after dictionary comparison in the regression test
Metadata
Metadata
Assignees
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.