aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/mixin.py
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-11-19 10:49:42 +0000
committerJessica Tallon <jessica@megworld.co.uk>2014-11-19 10:49:53 +0000
commit45e687fcf8873a687a890f45f85bc75fb09502c5 (patch)
tree16f76298637dae0efedc6296a57e0f5ce078bf3b /mediagoblin/db/mixin.py
parentc511fc5e5eefaadebf00a87e742ebc5358b7185d (diff)
downloadmediagoblin-45e687fcf8873a687a890f45f85bc75fb09502c5.tar.lz
mediagoblin-45e687fcf8873a687a890f45f85bc75fb09502c5.tar.xz
mediagoblin-45e687fcf8873a687a890f45f85bc75fb09502c5.zip
Fix #1023 - Make timestamps in API timezone aware
Diffstat (limited to 'mediagoblin/db/mixin.py')
-rw-r--r--mediagoblin/db/mixin.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py
index e8285e0c..7b1b1195 100644
--- a/mediagoblin/db/mixin.py
+++ b/mediagoblin/db/mixin.py
@@ -31,6 +31,7 @@ import uuid
import re
from datetime import datetime
+from pytz import UTC
from werkzeug.utils import cached_property
from mediagoblin import mg_globals
@@ -447,12 +448,14 @@ class ActivityMixin(object):
return self.content
def serialize(self, request):
+ published = UTC.localize(self.published)
+ updated = UTC.localize(self.updated)
obj = {
"id": self.id,
"actor": self.get_actor.serialize(request),
"verb": self.verb,
- "published": self.published.isoformat(),
- "updated": self.updated.isoformat(),
+ "published": published.isoformat(),
+ "updated": updated.isoformat(),
"content": self.content,
"url": self.get_url(request),
"object": self.get_object.serialize(request),