[openstack-dev] [Oslo] jsonutils support for datetimes

Flavio Percoco flavio at redhat.com
Mon Jun 3 17:10:23 UTC 2013


On 03/06/13 09:14 -0400, Doug Hellmann wrote:
>   On Mon, Jun 3, 2013 at 7:33 AM, Flavio Percoco <[1]flavio at redhat.com>
>   wrote:
>         3) Serialize the datetime as a dictionary with the following
>         structure:
>             {"_type": "datetime",          "_value": "....",
>     "_format": "%Y-%m-%dT%H:%M:%S.%f"}
>                 The above will allow the de-serializer to know whether
>     it
>             should be converted, the object type (datetime, date or
>     time)
>             and the format it was serialized with. I don't like this
>     idea
>             but I see the benefit of having all that information.
>
>   You could also just include the _type and _value, leaving the
>   interpretation of that value up to the receiver.

Interesting, might make sense. I'll try this as well.

I guess the default format would be specified in the Deserializer
instance or the loads call.

>   At the summit there was a proposal in the nova track to support sending
>   arbitrary objects over RPC transparently as part of the versioned
>   object session [1]. I think the final proposal involved using a
>   registry of types with serializers and deserializers. Datetimes could
>   just be another type in that registry system.

mmh, didn't know about this. I'll dig more on the proposal.

Cheers,
FF

-- 
@flaper87
Flavio Percoco



More information about the OpenStack-dev mailing list