changeset 1588:4ecae80d6d39

pages (events/rsvp): fix call of `bridge.events_get` + use coroutines instead of inline callbacks
author Goffi <goffi@goffi.org>
date Sun, 10 Dec 2023 10:59:25 +0100
parents 860e33127245
children 7228fc3c4744
files libervia/web/pages/events/rsvp/page_meta.py
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/web/pages/events/rsvp/page_meta.py	Sun Dec 10 10:57:48 2023 +0100
+++ b/libervia/web/pages/events/rsvp/page_meta.py	Sun Dec 10 10:59:25 2023 +0100
@@ -29,8 +29,7 @@
     )
 
 
-@defer.inlineCallbacks
-def prepare_render(self, request):
+async def prepare_render(self, request):
     template_data = request.template_data
     data = self.get_r_data(request)
     profile = self.get_profile(request)
@@ -40,11 +39,12 @@
     event_service = data["event_service"]
     event_node = data["event_node"]
     event_id = data["event_id"]
-    event_timestamp, event_data = yield self.host.bridge_call(
-        "eventGet",
+    event_timestamp, event_data = await self.host.bridge_call(
+        "events_get",
         event_service.userhost() if event_service else "",
         event_node,
-        event_id,
+        [event_id],
+        "",
         profile,
     )
     try:
@@ -62,11 +62,12 @@
             % html.escape(background_image, True)
         )
     template_data["event"] = event_data
-    event_invitee_data = yield self.host.bridge_call(
+    event_invitee_data = await self.host.bridge_call(
         "event_invitee_get",
         event_data["invitees_service"],
         event_data["invitees_node"],
-        '',
+        [],
+        "",
         profile,
     )
     template_data["invitee"] = event_invitee_data
@@ -81,21 +82,20 @@
     # we now need blog items, using blog common page
     # this will fill the "items" template data
     blog_page = self.get_page_by_name("blog_view")
-    yield blog_page.prepare_render(self, request)
+    await blog_page.prepare_render(self, request)
 
 
-@defer.inlineCallbacks
-def on_data_post(self, request):
+async def on_data_post(self, request):
     type_ = self.get_posted_data(request, "type")
     if type_ == "comment":
         blog_page = self.get_page_by_name("blog_view")
-        yield blog_page.on_data_post(self, request)
+        await blog_page.on_data_post(self, request)
     elif type_ == "attendance":
         profile = self.get_profile(request)
         service, node, attend, guests = self.get_posted_data(
             request, ("service", "node", "attend", "guests")
         )
         data = {"attend": attend, "guests": guests}
-        yield self.host.bridge_call("event_invitee_set", service, node, data, profile)
+        await self.host.bridge_call("event_invitee_set", service, node, data, profile)
     else:
         log.warning(_("Unhandled data type: {}").format(type_))