예제 #1
0
 def json(self):
     return {
         "id": self.key.id(),
         "deleted": self.deleted,
         "article_id": self.article.id(),
         "added": timestamp_from_datetime(self.added),
         "last_modified": timestamp_from_datetime(self.last_modified),
         "reading_position": self.reading_position
     }
예제 #2
0
 def json(self, include_article_json=False):
     d = {
         "id": self.key.id(),
         "url": self.url,
         "amp_url": self.amp_url,
         "submission_url": self.submission_url,
         "title": self.title.strip() if self.title else "",
         "fetch_failed": self.fetch_failed,
         "top_image": self.top_image,
         "top_image_tiny_json": self.top_image_tiny_json,
         "author": self.author,
         "site_name": self.site_name,
         "published": timestamp_from_datetime(self.published) if self.published else None,
         "description": self.description
     }
     if include_article_json:
         # print 'getting json; j: ', (not not self.content)
         d['article_json'] = self.content.get().article_json if self.content else None
     return d