#12261: strftime function from django.utils.datetime_safe doesn't work properly
in
years below 1000
---------------------------------------------+------------------------------
Reporter: versae | Owner: nobody
Status: new | Milestone:
Component: Serialization | Version: 1.1
Keywords: datetime serialization strftime | Stage: Unreviewed
Has_patch: 1 |
---------------------------------------------+------------------------------
If a model has a DateTimeField attribute, in order to serialize the
objects, django uses the format "%Y/%m/%d". However the function
{{{strftime}}} doesn't handle properly the option "%Y" in years below
1000: instead to fill with zeros (0) until to complete the 4 digits, it
uses spaces. Therefore, at deserialization time django raises a exception.
Currently
{{{
>>> datetime_safe.date(850, 8, 2).strftime("%Y/%m/%d")
' 850/00/02'
}}}
It must to be
{{{
>>> datetime_safe.date(850, 8, 2).strftime("%Y/%m/%d")
'0850/00/02'
}}}
The simplest patch is atached, but this issue can be deeper.
--
Ticket URL: <http://code.djangoproject.com/ticket/12261>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.