Opened 16 years ago

Closed 13 years ago

#10201 closed Bug (fixed)

serializers.serialize loses microseconds information.

Reported by: Nikolay Owned by: nobody
Component: Core (Serialization) Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

An example to show the bug nature:

>>> HRActionEvent.objects.all()[1:2]
[<HRActionEvent: [2009-02-04 11:13:35.588976] "SendEmail4">]
>>> HRActionEvent.objects.all()[1].time
datetime.datetime(2009, 2, 4, 11, 13, 35, 588976)
>>> serializers.serialize('xml', HRActionEvent.objects.all()[1:2])
'<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0">
 <object pk="655" model="hrdb.hractionevent">
  <field type="DateTimeField" name="time">2009-02-04 11:13:35</field>
  <field to="hrdb.hraction" name="action" rel="ManyToOneRel">13</field>
  <field type="BooleanField" name="action_sent_for_exec">True</field>
  <field type="BooleanField" name="action_executed">True</field>
 </object>
</django-objects>'

Significant information about 588976 microseconds has been lost during serialization.

Change History (4)

comment:1 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:2 by Jacob, 16 years ago

Triage Stage: UnreviewedDesign decision needed

ISTR we did this for a reason, but I can't recall what it was, exactly -- compatibility with databases that don't understand microseconds, maybe?

comment:3 by Chris Beaven, 14 years ago

Severity: Normal
Summary: serializers.serialize looses microseconds information.serializers.serialize loses microseconds information.
Type: Bug

comment:4 by Aymeric Augustin, 13 years ago

Easy pickings: unset
Resolution: fixed
Status: newclosed
UI/UX: unset

I fixed that while I was working on time zone support.

See this message to django-developers for more details on the design decisions.

Note: See TracTickets for help on using tickets.
Back to Top