diff libervia/pages/blog/view/atom.xml/page_meta.py @ 1216:b2d067339de3

python 3 port: /!\ Python 3.6+ is now needed to use libervia /!\ instability may occur and features may not be working anymore, this will improve with time /!\ TxJSONRPC dependency has been removed The same procedure as in backend has been applied (check backend commit ab2696e34d29 logs for details). Removed now deprecated code (Pyjamas compiled browser part, legacy blog, JSON RPC related code). Adapted code to work without `html` and `themes` dirs.
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:12:31 +0200
parents 28e3eb3bb217
children f511f8fbbf8a
line wrap: on
line diff
--- a/libervia/pages/blog/view/atom.xml/page_meta.py	Tue Aug 13 09:39:33 2019 +0200
+++ b/libervia/pages/blog/view/atom.xml/page_meta.py	Tue Aug 13 19:12:31 2019 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 from libervia.server.constants import Const as C
@@ -6,36 +6,36 @@
 from sat.tools.common import uri
 import time
 
-name = u"blog_feed_atom"
+name = "blog_feed_atom"
 access = C.PAGES_ACCESS_PUBLIC
-template = u"blog/atom.xml"
+template = "blog/atom.xml"
 
 
 @defer.inlineCallbacks
 def prepare_render(self, request):
     request.setHeader("Content-Type", "application/atom+xml; charset=utf-8")
     data = self.getRData(request)
-    service, node = data[u"service"], data.get(u"node")
+    service, node = data["service"], data.get("node")
     self.checkCache(
         request, C.CACHE_PUBSUB, service=service, node=node, short="microblog"
     )
     data["show_comments"] = False
     template_data = request.template_data
-    blog_page = self.getPageByName(u"blog_view")
+    blog_page = self.getPageByName("blog_view")
     yield blog_page.prepare_render(self, request)
-    items = data[u"items"]
+    items = data["items"]
 
-    template_data[u"request_uri"] = self.host.getExtBaseURL(
+    template_data["request_uri"] = self.host.getExtBaseURL(
         request, request.path.decode("utf-8")
     )
-    template_data[u"xmpp_uri"] = uri.buildXMPPUri(
-        u"pubsub", subtype=u"microblog", path=service.full(), node=node
+    template_data["xmpp_uri"] = uri.buildXMPPUri(
+        "pubsub", subtype="microblog", path=service.full(), node=node
     )
-    blog_view = self.getPageByName(u"blog_view")
-    template_data[u"http_uri"] = self.host.getExtBaseURL(
+    blog_view = self.getPageByName("blog_view")
+    template_data["http_uri"] = self.host.getExtBaseURL(
         request, blog_view.getURL(service.full(), node)
     )
     if items:
-        template_data[u"updated"] = items[0].updated
+        template_data["updated"] = items[0].updated
     else:
-        template_data[u"updated"] = time.time()
+        template_data["updated"] = time.time()