aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-07-11 15:23:55 +0100
committerJessica Tallon <jessica@megworld.co.uk>2014-07-22 23:13:16 +0100
commit51ab51921e5104f1b71402d38928651562c7134a (patch)
treec83072931ed60b597ff48f036c394f97bb739557 /mediagoblin/db/models.py
parent967df5eff0c00fe7cd860ebfb297ee1f2e0bcdaf (diff)
downloadmediagoblin-51ab51921e5104f1b71402d38928651562c7134a.tar.lz
mediagoblin-51ab51921e5104f1b71402d38928651562c7134a.tar.xz
mediagoblin-51ab51921e5104f1b71402d38928651562c7134a.zip
Add more tests for federation APIs
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r--mediagoblin/db/models.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index cc5d0afa..27ca74e0 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -446,9 +446,8 @@ class MediaEntry(Base, MediaEntryMixin):
)
context = {
- "id": self.id,
+ "id": self.id,
"author": author.serialize(request),
- "displayName": self.title,
"objectType": self.objectType,
"url": url,
"image": {
@@ -464,6 +463,15 @@ class MediaEntry(Base, MediaEntryMixin):
},
}
+ if self.title:
+ context["displayName"] = self.title
+
+ if self.description:
+ context["content"] = self.description
+
+ if self.license:
+ context["license"] = self.license
+
if show_comments:
comments = [comment.serialize(request) for comment in self.get_comments()]
total = len(comments)
@@ -478,7 +486,7 @@ class MediaEntry(Base, MediaEntryMixin):
),
}
- return context
+ return context
class FileKeynames(Base):
"""
@@ -630,6 +638,7 @@ class MediaComment(Base, MediaCommentMixin):
media = MediaEntry.query.filter_by(id=self.media_entry).first()
author = self.get_author
context = {
+ "id": self.id,
"objectType": "comment",
"content": self.content,
"inReplyTo": media.serialize(request, show_comments=False),