diff libervia/pages/tickets/new/page_meta.py @ 1302:04e7dd6b6f4d

pages (blog, tickets, merge-requests): updated code to handle new serialisation, following backend changes
author Goffi <goffi@goffi.org>
date Thu, 16 Jul 2020 09:08:47 +0200
parents f511f8fbbf8a
children
line wrap: on
line diff
--- a/libervia/pages/tickets/new/page_meta.py	Fri Jun 19 16:47:51 2020 +0200
+++ b/libervia/pages/tickets/new/page_meta.py	Thu Jul 16 09:08:47 2020 +0200
@@ -1,6 +1,5 @@
 #!/usr/bin/env python3
 
-
 from libervia.server.constants import Const as C
 from twisted.internet import defer
 from sat.tools.common import template_xmlui
@@ -14,13 +13,12 @@
 template = "ticket/create.html"
 
 
-@defer.inlineCallbacks
-def prepare_render(self, request):
+async def prepare_render(self, request):
     data = self.getRData(request)
     template_data = request.template_data
     service, node = data.get("service", ""), data.get("node", "")
     profile = self.getProfile(request)
-    schema = yield self.host.bridgeCall("ticketsSchemaGet", service.full(), node, profile)
+    schema = await self.host.bridgeCall("ticketsSchemaGet", service.full(), node, profile)
     data["schema"] = schema
     # following fields are handled in backend
     ignore = (
@@ -45,14 +43,13 @@
     wid = xmlui_obj.widgets['body']
     if wid.type == "xhtmlbox":
         wid.type = "textbox"
-        wid.value =  yield self.host.bridgeCall(
+        wid.value =  await self.host.bridgeCall(
             "syntaxConvert", wid.value, C.SYNTAX_XHTML, "markdown",
             False, profile)
     template_data["new_ticket_xmlui"] = xmlui_obj
 
 
-@defer.inlineCallbacks
-def on_data_post(self, request):
+async def on_data_post(self, request):
     data = self.getRData(request)
     service = data["service"]
     node = data["node"]
@@ -66,14 +63,14 @@
     profile = self.getProfile(request)
 
     # we convert back body to XHTML
-    body = yield self.host.bridgeCall(
+    body = await self.host.bridgeCall(
         "syntaxConvert", posted_data['body'][0], "markdown", C.SYNTAX_XHTML,
         False, profile)
     posted_data['body'] = ['<div xmlns="{ns}">{body}</div>'.format(ns=C.NS_XHTML,
                                                                      body=body)]
 
 
-    yield self.host.bridgeCall(
+    await self.host.bridgeCall(
         "ticketSet", service.full(), node, posted_data, "", "", "", profile
     )
     # we don't want to redirect to creation page on success, but to tickets list