diff libervia/pages/files/list/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 ce879da7fcf7
children
line wrap: on
line diff
--- a/libervia/pages/files/list/page_meta.py	Fri Apr 07 15:20:40 2023 +0200
+++ b/libervia/pages/files/list/page_meta.py	Sat Apr 08 13:44:11 2023 +0200
@@ -19,38 +19,38 @@
 
 
 def parse_url(self, request):
-    self.getPathArgs(request, ["service", "*path"], min_args=1, service="jid", path="")
+    self.get_path_args(request, ["service", "*path"], min_args=1, service="jid", path="")
 
 
 def add_breadcrumb(self, request, breadcrumbs):
-    data = self.getRData(request)
+    data = self.get_r_data(request)
     breadcrumbs.append({
         "label": data["service"],
-        "url": self.getURL(data["service"].full()),
+        "url": self.get_url(data["service"].full()),
         "icon": "server",
     })
     for idx, p in enumerate(data["path"]):
         breadcrumbs.append({
             "label": p,
-            "url": self.getURL(data["service"].full(), *data["path"][:idx+1]),
+            "url": self.get_url(data["service"].full(), *data["path"][:idx+1]),
             "icon": "folder-open-empty",
         })
 
 
 async def prepare_render(self, request):
-    data = self.getRData(request)
+    data = self.get_r_data(request)
     thumb_limit = data.get("thumb_limit", 400)
     template_data = request.template_data
     service, path_elts = data["service"], data["path"]
     path = Path('/', *path_elts)
-    profile = self.getProfile(request) or C.SERVICE_PROFILE
-    session_data = self.host.getSessionData(
+    profile = self.get_profile(request) or C.SERVICE_PROFILE
+    session_data = self.host.get_session_data(
         request, session_iface.IWebSession
     )
 
     try:
-        files_data = await self.host.bridgeCall(
-            "FISList", service.full(), str(path), {}, profile)
+        files_data = await self.host.bridge_call(
+            "fis_list", service.full(), str(path), {}, profile)
     except BridgeException as e:
         if e.condition == 'item-not-found':
             log.debug(
@@ -70,7 +70,7 @@
         if file_data["type"] == C.FILE_TYPE_DIRECTORY:
             page = self
         elif file_data["type"] == C.FILE_TYPE_FILE:
-            page = self.getPageByName("files_view")
+            page = self.get_page_by_name("files_view")
 
             # we set URL for the last thumbnail which has a size below thumb_limit
             try:
@@ -90,12 +90,12 @@
             raise ValueError(
                 "unexpected file type: {file_type}".format(file_type=file_data["type"])
             )
-        file_data["url"] = page.getURL(service.full(), *dir_path)
+        file_data["url"] = page.get_url(service.full(), *dir_path)
 
         ## comments ##
         comments_url = file_data.get("comments_url")
         if comments_url:
-            parsed_url = uri.parseXMPPUri(comments_url)
+            parsed_url = uri.parse_xmpp_uri(comments_url)
             comments_service = file_data["comments_service"] = parsed_url["path"]
             comments_node = file_data["comments_node"] = parsed_url["node"]
             try:
@@ -105,7 +105,7 @@
             except KeyError:
                 comments_count = None
             if comments_count and data.get("retrieve_comments", False):
-                file_data["comments"] = await pages_tools.retrieveComments(
+                file_data["comments"] = await pages_tools.retrieve_comments(
                     self, comments_service, comments_node, profile=profile
                 )
 
@@ -113,8 +113,8 @@
     # TODO: some caching? What if affiliation changes?
 
     try:
-        affiliations = await self.host.bridgeCall(
-            "FISAffiliationsGet", service.full(), "", str(path), profile
+        affiliations = await self.host.bridge_call(
+            "fis_affiliations_get", service.full(), "", str(path), profile
         )
     except BridgeException as e:
         if e.condition == 'item-not-found':
@@ -134,7 +134,7 @@
     if directory_affiliation == "owner":
         # we need to transtype dict items to str because with some bridges (D-Bus)
         # we have a specific type which can't be exposed
-        self.exposeToScripts(
+        self.expose_to_scripts(
             request,
             affiliations={str(e): str(a) for e, a in affiliations.items()}
         )
@@ -142,11 +142,11 @@
     template_data["directory_affiliation"] = directory_affiliation
     template_data["files_data"] = files_data
     template_data["path"] = path
-    self.exposeToScripts(
+    self.expose_to_scripts(
         request,
         directory_affiliation=str(directory_affiliation),
         files_service=service.full(),
         files_path=str(path),
     )
     if path_elts:
-        template_data["parent_url"] = self.getURL(service.full(), *path_elts[:-1])
+        template_data["parent_url"] = self.get_url(service.full(), *path_elts[:-1])