diff libervia/pages/files/view/page_meta.py @ 1421:e065c8886b81

pages (files/list): set empty affiliations when they can't be retrieved
author Goffi <goffi@goffi.org>
date Sat, 01 May 2021 19:04:25 +0200
parents f511f8fbbf8a
children 106bae41f5c8
line wrap: on
line diff
--- a/libervia/pages/files/view/page_meta.py	Sat May 01 18:50:04 2021 +0200
+++ b/libervia/pages/files/view/page_meta.py	Sat May 01 19:04:25 2021 +0200
@@ -3,7 +3,6 @@
 
 from libervia.server.constants import Const as C
 from sat.core.i18n import _
-from twisted.internet import defer
 from twisted.web import static
 from libervia.server.utils import ProgressHandler
 import tempfile
@@ -33,8 +32,7 @@
         log.warning(_("Can't remove temporary directory {path}").format(path=tmp_dir))
 
 
-@defer.inlineCallbacks
-def render(self, request):
+async def render(self, request):
     data = self.getRData(request)
     profile = self.getProfile(request)
     service, path_elts = data["service"], data["path"]
@@ -44,7 +42,7 @@
     tmp_dir = tempfile.mkdtemp()
     dest_path = os.path.join(tmp_dir, basename)
     request.notifyFinish().addCallback(cleanup, tmp_dir, dest_path)
-    progress_id = yield self.host.bridgeCall(
+    progress_id = await self.host.bridgeCall(
         "fileJingleRequest",
         service.full(),
         dest_path,
@@ -55,6 +53,6 @@
         profile,
     )
     log.debug("file requested")
-    yield ProgressHandler(self.host, progress_id, profile).register()
+    await ProgressHandler(self.host, progress_id, profile).register()
     log.debug("file downloaded")
     self.delegateToResource(request, static.File(dest_path))