diff libervia/pages/u/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 67ec22356457
children f511f8fbbf8a
line wrap: on
line diff
--- a/libervia/pages/u/page_meta.py	Tue Aug 13 09:39:33 2019 +0200
+++ b/libervia/pages/u/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
@@ -7,9 +7,9 @@
 
 """page used to target a user profile, e.g. for public blog"""
 
-name = u"user"
+name = "user"
 access = C.PAGES_ACCESS_PUBLIC  # can be a callable
-template = u"blog/articles.html"
+template = "blog/articles.html"
 url_cache = True
 
 
@@ -23,31 +23,31 @@
     data = self.getRData(request)
 
     target_profile = yield self.host.bridgeCall("profileNameGet", prof_requested)
-    request.template_data[u"target_profile"] = target_profile
+    request.template_data["target_profile"] = target_profile
     target_jid = yield self.host.bridgeCall(
         "asyncGetParamA", "JabberID", "Connection", "value", profile_key=target_profile
     )
     target_jid = jid.JID(target_jid)
-    data[u"service"] = target_jid
+    data["service"] = target_jid
 
     # if URL is parsed here, we'll have atom.xml available and we need to
     # add the link to the page
-    atom_url = self.getSubPageURL(request, u'user_blog_feed_atom')
-    request.template_data[u'atom_url'] = atom_url
-    request.template_data.setdefault(u'links', []).append({
-        u"href": atom_url,
-        u"type": "application/atom+xml",
-        u"rel": "alternate",
-        u"title": "{target_profile}'s blog".format(target_profile=target_profile)})
+    atom_url = self.getSubPageURL(request, 'user_blog_feed_atom')
+    request.template_data['atom_url'] = atom_url
+    request.template_data.setdefault('links', []).append({
+        "href": atom_url,
+        "type": "application/atom+xml",
+        "rel": "alternate",
+        "title": "{target_profile}'s blog".format(target_profile=target_profile)})
 
 
 @defer.inlineCallbacks
 def prepare_render(self, request):
     data = self.getRData(request)
     self.checkCache(
-        request, C.CACHE_PUBSUB, service=data[u"service"], node=None, short="microblog"
+        request, C.CACHE_PUBSUB, service=data["service"], node=None, short="microblog"
     )
-    self.pageRedirect(u"blog_view", request)
+    self.pageRedirect("blog_view", request)
 
 def on_data_post(self, request):
-    return self.getPageByName(u"blog_view").on_data_post(self, request)
+    return self.getPageByName("blog_view").on_data_post(self, request)