Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5354 closed defect (fixed)

Graveyard media don't return serializable timestamps

Reported by: ayleph Owned by:
Priority: critical Milestone: 0.9.0
Component: programming Keywords: api, json, graveyard
Cc: tsyesika Parent Tickets:

Description

Entries in core__graveyard don't return a serializable JSON timestamp, resulting in failures of pump clients. The below patch addresses this issue.

From 7782960e044b9a366ac46cfaf687af4fceb17c3e Mon Sep 17 00:00:00 2001
From: ayleph <ayleph@thisshitistemp.com>
Date: Sat, 31 Oct 2015 03:04:06 -0400
Subject: [PATCH] Return deleted time in serializable format

---
 mediagoblin/db/models.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 6765955..0de14b4 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -1562,13 +1562,14 @@ class Graveyard(Base):
         )   
 
     def serialize(self, request):
+        deleted = UTC.localize(self.deleted)
         return {
             "id": self.public_id,
             "objectType": self.object_type,
             "actor": self.actor(),
-            "published": self.deleted,
-            "updated": self.deleted,
-            "deleted": self.deleted
+            "published": deleted.isoformat(),
+            "updated": deleted.isoformat(),
+            "deleted": deleted.isoformat()
         }   
 
 MODELS = [ 
-- 
2.6.2

Change History (6)

comment:1 by ayleph, 9 years ago

Status: newreview

comment:2 by ayleph, 9 years ago

Milestone: 0.8.1

comment:3 by Christopher Allan Webber, 9 years ago

Let's have Jessica review this one when she gets back next week.

comment:4 by ayleph, 9 years ago

Okay with me. I neglected to mention this in the ticket, but I copied the style of handling datetime objects (UTC.localize & isoformat) from serialize functions of the other classes, so it's all consistent with current programming.

comment:5 by Jessica Tallon, 9 years ago

Resolution: fixed
Status: reviewclosed

This has been fixed with commit 89068c2. Thanks Alyeph.

comment:6 by Christopher Allan Webber, 9 years ago

Milestone: 0.8.20.9.0

All 0.8.2 tickets are being rolled over to 0.9.0

Note: See TracTickets for help on using tickets.