Code

Opened 5 years ago

Closed 2 years ago

#10201 closed Bug (fixed)

serializers.serialize loses microseconds information.

Reported by: niksite 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.

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:2 Changed 5 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design 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 Changed 3 years ago by SmileyChris

  • Severity set to Normal
  • Summary changed from serializers.serialize looses microseconds information. to serializers.serialize loses microseconds information.
  • Type set to Bug

comment:4 Changed 2 years ago by aaugustin

  • Easy pickings unset
  • Resolution set to fixed
  • Status changed from new to closed
  • 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.