Mercurial > libervia-web
comparison libervia/pages/files/list/page_meta.py @ 1349:886d1856e9de
pages (files/list): fixed empty dir handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 05 Sep 2020 21:59:17 +0200 |
parents | 089742e065e3 |
children | 6fc41f000d24 |
comparison
equal
deleted
inserted
replaced
1348:c74e5a488af6 | 1349:886d1856e9de |
---|---|
95 ) | 95 ) |
96 | 96 |
97 # parent dir affiliation | 97 # parent dir affiliation |
98 # TODO: some caching? What if affiliation changes? | 98 # TODO: some caching? What if affiliation changes? |
99 | 99 |
100 affiliations = await self.host.bridgeCall( | 100 try: |
101 "FISAffiliationsGet", service.full(), "", str(path), profile | 101 affiliations = await self.host.bridgeCall( |
102 ) | 102 "FISAffiliationsGet", service.full(), "", str(path), profile |
103 ) | |
104 except BridgeException as e: | |
105 if e.condition == 'item-not-found': | |
106 log.debug( | |
107 f'"item-not-found" received for {path} at {service}, this may indicate ' | |
108 f'that the location is new') | |
109 # FIXME: Q&D handling of empty dir (e.g. new directory/photos album) | |
110 affiliations = { | |
111 session_data.jid.userhost(): "owner" | |
112 } | |
113 else: | |
114 raise e | |
115 | |
103 directory_affiliation = affiliations.get(session_data.jid.userhost()) | 116 directory_affiliation = affiliations.get(session_data.jid.userhost()) |
104 if directory_affiliation == "owner": | 117 if directory_affiliation == "owner": |
105 # we need to transtype dict items to str because with some bridges (D-Bus) | 118 # we need to transtype dict items to str because with some bridges (D-Bus) |
106 # we have a specific type which can't be exposed | 119 # we have a specific type which can't be exposed |
107 self.exposeToScripts( | 120 self.exposeToScripts( |