diff libervia/pages/events/rsvp/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 29eb15062416
children acec8e9185db
line wrap: on
line diff
--- a/libervia/pages/events/rsvp/page_meta.py	Tue Aug 13 09:39:33 2019 +0200
+++ b/libervia/pages/events/rsvp/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
@@ -12,9 +12,9 @@
 
 """creation of new events"""
 
-name = u"event_rsvp"
+name = "event_rsvp"
 access = C.PAGES_ACCESS_PROFILE
-template = u"event/invitation.html"
+template = "event/invitation.html"
 log = getLogger(__name__)
 
 
@@ -37,10 +37,10 @@
     ## Event ##
 
     event_service = data["event_service"]
-    event_node = data[u"event_node"]
-    event_id = data[u"event_id"]
+    event_node = data["event_node"]
+    event_id = data["event_id"]
     event_timestamp, event_data = yield self.host.bridgeCall(
-        u"eventGet",
+        "eventGet",
         event_service.userhost() if event_service else "",
         event_node,
         event_id,
@@ -52,7 +52,7 @@
         pass
     else:
         template_data["dynamic_style"] = safe(
-            u"""
+            """
             html {
                 background-image: url("%s");
                 background-size: 15em;
@@ -62,7 +62,7 @@
         )
     template_data["event"] = event_data
     event_invitee_data = yield self.host.bridgeCall(
-        u"eventInviteeGet",
+        "eventInviteeGet",
         event_data["invitees_service"],
         event_data["invitees_node"],
         profile,
@@ -72,28 +72,28 @@
 
     ## Blog ##
 
-    data[u"service"] = jid.JID(event_data[u"blog_service"])
-    data[u"node"] = event_data[u"blog_node"]
-    data[u"allow_commenting"] = u"simple"
+    data["service"] = jid.JID(event_data["blog_service"])
+    data["node"] = event_data["blog_node"]
+    data["allow_commenting"] = "simple"
 
     # we now need blog items, using blog common page
     # this will fill the "items" template data
-    blog_page = self.getPageByName(u"blog_view")
+    blog_page = self.getPageByName("blog_view")
     yield blog_page.prepare_render(self, request)
 
 
 @defer.inlineCallbacks
 def on_data_post(self, request):
-    type_ = self.getPostedData(request, u"type")
-    if type_ == u"comment":
-        blog_page = self.getPageByName(u"blog_view")
+    type_ = self.getPostedData(request, "type")
+    if type_ == "comment":
+        blog_page = self.getPageByName("blog_view")
         yield blog_page.on_data_post(self, request)
-    elif type_ == u"attendance":
+    elif type_ == "attendance":
         profile = self.getProfile(request)
         service, node, attend, guests = self.getPostedData(
-            request, (u"service", u"node", u"attend", u"guests")
+            request, ("service", "node", "attend", "guests")
         )
-        data = {u"attend": attend, u"guests": guests}
-        yield self.host.bridgeCall(u"eventInviteeSet", service, node, data, profile)
+        data = {"attend": attend, "guests": guests}
+        yield self.host.bridgeCall("eventInviteeSet", service, node, data, profile)
     else:
-        log.warning(_(u"Unhandled data type: {}").format(type_))
+        log.warning(_("Unhandled data type: {}").format(type_))