diff libervia/pages/lists/view_item/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/lists/view_item/page_meta.py	Fri Apr 07 15:20:40 2023 +0200
+++ b/libervia/pages/lists/view_item/page_meta.py	Sat Apr 08 13:44:11 2023 +0200
@@ -20,16 +20,16 @@
 
 
 def parse_url(self, request):
-    self.getPathArgs(request, ["service", "node", "item_id"], service="jid", node="@")
-    data = self.getRData(request)
+    self.get_path_args(request, ["service", "node", "item_id"], service="jid", node="@")
+    data = self.get_r_data(request)
     if data["item_id"] is None:
         log.warning(_("no list item id specified"))
-        self.pageError(request, C.HTTP_BAD_REQUEST)
+        self.page_error(request, C.HTTP_BAD_REQUEST)
 
 
 def add_breadcrumb(self, request, breadcrumbs):
-    data = self.getRData(request)
-    list_url = self.getPageByName("lists").getURL(data["service"].full(),
+    data = self.get_r_data(request)
+    list_url = self.get_page_by_name("lists").get_url(data["service"].full(),
                                                   data.get("node") or "@")
     breadcrumbs.append({
         "label": D_("List"),
@@ -41,23 +41,23 @@
 
 
 async def prepare_render(self, request):
-    data = self.getRData(request)
+    data = self.get_r_data(request)
     template_data = request.template_data
-    session = self.host.getSessionData(request, session_iface.IWebSession)
+    session = self.host.get_session_data(request, session_iface.IWebSession)
     service, node, item_id = (
         data.get("service", ""),
         data.get("node", ""),
         data["item_id"],
     )
     namespace = node or self.host.ns_map["tickets"]
-    node = await self.host.bridgeCall("psSchemaSubmittedNodeGet", namespace)
+    node = await self.host.bridge_call("ps_schema_submitted_node_get", namespace)
 
-    profile = self.getProfile(request)
+    profile = self.get_profile(request)
     if profile is None:
         profile = C.SERVICE_PROFILE
 
-    list_raw = await self.host.bridgeCall(
-        "listGet",
+    list_raw = await self.host.bridge_call(
+        "list_get",
         service.full() if service else "",
         node,
         C.NO_LIMIT,
@@ -75,12 +75,12 @@
         pass
     else:
         if comments_uri:
-            uri_data = uri.parseXMPPUri(comments_uri)
+            uri_data = uri.parse_xmpp_uri(comments_uri)
             template_data["comments_node"] = comments_node = uri_data["node"]
             template_data["comments_service"] = comments_service = uri_data["path"]
             try:
-                comments = data_format.deserialise(await self.host.bridgeCall(
-                    "mbGet", comments_service, comments_node, C.NO_LIMIT, [],
+                comments = data_format.deserialise(await self.host.bridge_call(
+                    "mb_get", comments_service, comments_node, C.NO_LIMIT, [],
                     data_format.serialise({}), profile
                 ))
             except BridgeException as e:
@@ -93,8 +93,8 @@
                     raise e
             else:
                 template_data["comments"] = comments
-                template_data["login_url"] = self.getPageRedirectURL(request)
-                self.exposeToScripts(
+                template_data["login_url"] = self.get_page_redirect_url(request)
+                self.expose_to_scripts(
                     request,
                     comments_node=comments_node,
                     comments_service=comments_service,
@@ -107,16 +107,16 @@
         is_publisher = publisher.userhostJID() == session.jid.userhostJID()
         affiliation = None
         if not is_publisher:
-            affiliation = await self.host.getAffiliation(request, service, node)
+            affiliation = await self.host.get_affiliation(request, service, node)
         if is_publisher or affiliation == "owner":
-            self.exposeToScripts(
+            self.expose_to_scripts(
                 request,
                 pubsub_service = service.full(),
                 pubsub_node = node,
                 pubsub_item = item_id,
             )
             template_data["can_modify"] = True
-            template_data["url_list_item_edit"] = self.getURLByPath(
+            template_data["url_list_item_edit"] = self.get_url_by_path(
                 SubPage("list_edit"),
                 service.full(),
                 node or "@",
@@ -128,13 +128,13 @@
     uri_args['node'] = node
     if item_id:
         uri_args['item'] = item_id
-    template_data['xmpp_uri'] = uri.buildXMPPUri('pubsub', **uri_args)
+    template_data['xmpp_uri'] = uri.build_xmpp_uri('pubsub', **uri_args)
 
 
 async def on_data_post(self, request):
-    type_ = self.getPostedData(request, "type")
+    type_ = self.get_posted_data(request, "type")
     if type_ == "comment":
-        blog_page = self.getPageByName("blog_view")
+        blog_page = self.get_page_by_name("blog_view")
         await blog_page.on_data_post(self, request)
     else:
         log.warning(_("Unhandled data type: {}").format(type_))