diff libervia/server/blog.py @ 1156:3048bd137aaf

server, browser: changed blog items serialisation following changes in backend
author Goffi <goffi@goffi.org>
date Sat, 23 Feb 2019 21:03:21 +0100
parents 2af117bfe6cc
children 1276452c0d32
line wrap: on
line diff
--- a/libervia/server/blog.py	Fri Feb 22 18:50:33 2019 +0100
+++ b/libervia/server/blog.py	Sat Feb 23 21:03:21 2019 +0100
@@ -353,6 +353,7 @@
 
         def gotItems(items):
             items, metadata = items
+            items = [data_format.deserialise(i) for i in items]
             item = items[0]  # assume there's only one item
 
             def gotMetadata(result):
@@ -377,7 +378,7 @@
                             item["comments_service"],
                             item["comments_node"],
                             "",
-                            comments[0],
+                            [data_format.deserialise(c) for c in comments[0]],
                             comments[1],
                         )
                     ]
@@ -488,6 +489,7 @@
             # Generate a clean atom feed with uri linking to this blog
             # from microblog data
             items, metadata = data
+            items = [data_format.deserialise(i) for i in items]
             feed_elt = domish.Element((NS_ATOM, u"feed"))
             title = _(u"{user}'s blog").format(user=profile)
             feed_elt.addElement(u"title", content=title)
@@ -574,7 +576,7 @@
                     pass
 
                 # categories
-                for tag in data_format.dict2iter("tag", item):
+                for tag in item.get('tags', []):
                     category_elt = entry_elt.addElement(u"category")
                     category_elt["term"] = tag
 
@@ -855,7 +857,7 @@
             if query_data:
                 self.url += "?{}".format(_urlencode(query_data))
             self.title = self.getText(entry, "title")
-            self.tags = [sanitizeHtml(tag) for tag in data_format.dict2iter("tag", entry)]
+            self.tags = [sanitizeHtml(tag) for tag in entry.get('tags', [])]
 
             count_text = lambda count: D_(u"comments") if count > 1 else D_(u"comment")