convert all date related values into datetime object

Bug #309950 reported by Markus Korn
4
Affects Status Importance Assigned to Milestone
launchpadlib
Fix Released
High
Unassigned

Bug Description

The lauchpad API exposes some date related values like bug.date_created, bug.last_message etc.
All this values are ISO 1601 formated time strings like:
   "2008-01-07T05:30:30.345323+00:00"
This strings are of no use for scripts using launchpadlib, they have to convert this values into datetime (or similar) objects. It would be nice if launchpad could automatically return datetime objects in this cases, or provide a generic function to convert this strings into datetime objects.

Markus

Revision history for this message
Markus Korn (thekorn) wrote :

As a workaround I'm using the parse_time() function from the attached module to convert the time strings provided by the API into datetime objects. I think it makes sense to use this function for simplejson to create datetime objects when running simplejson.loads()

Markus

Changed in launchpadlib:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Leonard Richardson (leonardr) wrote :

Markus, did you write this code? What's the license on it?

Revision history for this message
Markus Korn (thekorn) wrote :

Yes, this was written by me, I put in under GPL2 and added an additional doctest.

Revision history for this message
Leonard Richardson (leonardr) wrote :

The code is going into wadllib, which is LGPL3. Would you mind relicensing it?

Revision history for this message
Markus Korn (thekorn) wrote :

I'm fine with changing it into this LGPL3

Revision history for this message
Martin Pitt (pitti) wrote :

I believe this is fixed:

            print type(b.date_created)
            print b.date_created
            print b.date_created.ctime()

yields

<type 'datetime.datetime'>
2009-03-12 21:43:18.327983+00:00
Thu Mar 12 21:43:18 2009

Changed in launchpadlib:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.