# HG changeset patch # User Goffi # Date 1619888665 -7200 # Node ID e065c8886b818dec6519ba1013b5e7cce41b41d9 # Parent 925a7c498cda95bdfb894f1dfb121afd57a72c23 pages (files/list): set empty affiliations when they can't be retrieved diff -r 925a7c498cda -r e065c8886b81 libervia/pages/files/list/page_meta.py --- a/libervia/pages/files/list/page_meta.py Sat May 01 18:50:04 2021 +0200 +++ b/libervia/pages/files/list/page_meta.py Sat May 01 19:04:25 2021 +0200 @@ -125,6 +125,8 @@ affiliations = { session_data.jid.userhost(): "owner" } + if e.condition == "service-unavailable": + affiliations = {} else: raise e diff -r 925a7c498cda -r e065c8886b81 libervia/pages/files/page_meta.py --- a/libervia/pages/files/page_meta.py Sat May 01 18:50:04 2021 +0200 +++ b/libervia/pages/files/page_meta.py Sat May 01 19:04:25 2021 +0200 @@ -2,7 +2,6 @@ from libervia.server.constants import Const as C -from twisted.internet import defer from twisted.words.protocols.jabber import jid from sat.core.log import getLogger @@ -14,12 +13,11 @@ template = "file/discover.html" -@defer.inlineCallbacks -def prepare_render(self, request): +async def prepare_render(self, request): profile = self.getProfile(request) template_data = request.template_data namespace = self.host.ns_map["fis"] - entities_services, entities_own, entities_roster = yield self.host.bridgeCall( + entities_services, entities_own, entities_roster = await self.host.bridgeCall( "discoFindByFeatures", [namespace], [], False, True, True, True, False, profile ) tpl_service_entities = template_data["disco_service_entities"] = {} diff -r 925a7c498cda -r e065c8886b81 libervia/pages/files/view/page_meta.py --- 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))