Add static pump_io to API and fix problem where null appeared in profile
authorJessica Tallon <zslrd@inboxen.co.uk>
Wed, 4 Sep 2013 15:32:49 +0000 (16:32 +0100)
committerJessica Tallon <jessica@megworld.co.uk>
Tue, 22 Jul 2014 22:13:14 +0000 (23:13 +0100)
mediagoblin/db/models.py

index 4f5182d6c9f3e7880214025d77f6d2366eb7631e..cc22450f0f62081993a0f662d1d9f2ae8fded054 100644 (file)
@@ -143,8 +143,10 @@ class User(Base, UserMixin):
             "preferredUsername": self.username,
             "displayName": "{0}@{1}".format(self.username, request.host),
             "objectType": "person",
-            "url": self.url,
-            "summary": self.bio,
+            "pump_io": {
+                "shared": False,
+                "followed": False,
+            },
             "links": {
                 "self": {
                     "href": request.urlgen(
@@ -169,6 +171,12 @@ class User(Base, UserMixin):
                 },
             },
         }
+
+        if self.bio:
+            user.update({"summary": self.bio})
+        if self.url:
+            user.update({"url": self.url})
+
         return user
 
 class Client(Base):
@@ -458,6 +466,9 @@ class MediaEntry(Base, MediaEntryMixin):
             },
             "published": self.created.isoformat(),
             "updated": self.created.isoformat(),
+            "pump_io": {
+                "shared": False,
+            },
         }
 
         if show_comments: