comparison libervia/pages/files/page_meta.py @ 1509:106bae41f5c8

massive refactoring from camelCase -> snake_case. See backend commit log for more details
author Goffi <goffi@goffi.org>
date Sat, 08 Apr 2023 13:44:11 +0200
parents e065c8886b81
children
comparison
equal deleted inserted replaced
1508:ec3ad9abf9f9 1509:106bae41f5c8
12 access = C.PAGES_ACCESS_PROFILE 12 access = C.PAGES_ACCESS_PROFILE
13 template = "file/discover.html" 13 template = "file/discover.html"
14 14
15 15
16 async def prepare_render(self, request): 16 async def prepare_render(self, request):
17 profile = self.getProfile(request) 17 profile = self.get_profile(request)
18 template_data = request.template_data 18 template_data = request.template_data
19 namespace = self.host.ns_map["fis"] 19 namespace = self.host.ns_map["fis"]
20 entities_services, entities_own, entities_roster = await self.host.bridgeCall( 20 entities_services, entities_own, entities_roster = await self.host.bridge_call(
21 "discoFindByFeatures", [namespace], [], False, True, True, True, False, profile 21 "disco_find_by_features", [namespace], [], False, True, True, True, False, profile
22 ) 22 )
23 tpl_service_entities = template_data["disco_service_entities"] = {} 23 tpl_service_entities = template_data["disco_service_entities"] = {}
24 tpl_own_entities = template_data["disco_own_entities"] = {} 24 tpl_own_entities = template_data["disco_own_entities"] = {}
25 tpl_roster_entities = template_data["disco_roster_entities"] = {} 25 tpl_roster_entities = template_data["disco_roster_entities"] = {}
26 entities_url = template_data["entities_url"] = {} 26 entities_url = template_data["entities_url"] = {}
35 for entity_str, entity_ids in entities_map.items(): 35 for entity_str, entity_ids in entities_map.items():
36 entity_jid = jid.JID(entity_str) 36 entity_jid = jid.JID(entity_str)
37 tpl_entities[entity_jid] = identities = {} 37 tpl_entities[entity_jid] = identities = {}
38 for cat, type_, name in entity_ids: 38 for cat, type_, name in entity_ids:
39 identities.setdefault(cat, {}).setdefault(type_, []).append(name) 39 identities.setdefault(cat, {}).setdefault(type_, []).append(name)
40 entities_url[entity_jid] = self.getPageByName("files_list").getURL( 40 entities_url[entity_jid] = self.get_page_by_name("files_list").get_url(
41 entity_jid.full() 41 entity_jid.full()
42 ) 42 )
43 43
44 44
45 def on_data_post(self, request): 45 def on_data_post(self, request):
46 jid_str = self.getPostedData(request, "jid") 46 jid_str = self.get_posted_data(request, "jid")
47 try: 47 try:
48 jid_ = jid.JID(jid_str) 48 jid_ = jid.JID(jid_str)
49 except RuntimeError: 49 except RuntimeError:
50 self.pageError(request, C.HTTP_BAD_REQUEST) 50 self.page_error(request, C.HTTP_BAD_REQUEST)
51 url = self.getPageByName("files_list").getURL(jid_.full()) 51 url = self.get_page_by_name("files_list").get_url(jid_.full())
52 self.HTTPRedirect(request, url) 52 self.http_redirect(request, url)