changeset 22:5fd933e238bb

massive refactoring from camelCase -> snake_case. See backend commit log for more details
author Goffi <goffi@goffi.org>
date Mon, 22 May 2023 09:11:54 +0200
parents 67487063f421
children 395af2ad2bc9
files pages/association/membership/page_meta.py pages/documentation/page_meta.py pages/news/page_meta.py pages/social_contract/page_meta.py tasks/task_generate_doc.py tasks/task_social_contract.py
diffstat 6 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/pages/association/membership/page_meta.py	Tue Nov 30 17:39:46 2021 +0100
+++ b/pages/association/membership/page_meta.py	Mon May 22 09:11:54 2023 +0200
@@ -64,25 +64,25 @@
     "Please fill all the required fields, thank you!")
 
 async def on_data_post(self, request):
-    data = FormData(*self.getPostedData(request, FIELDS, raise_on_missing=False))
+    data = FormData(*self.get_posted_data(request, FIELDS, raise_on_missing=False))
     if any(not getattr(data, f) for f in REQUIRED):
         log.warning("missing data fields:\n{data}".format(data=data))
         raise exceptions.DataError(WARNING_MSG_MISSING_FIELDS)
     if not C.bool(data.documents_read or C.BOOL_FALSE):
         log.warning("documents_read has not been checked:\n{data}".format(data=data))
         raise exceptions.DataError(WARNING_MSG_NOT_READ)
-    addresses = config.getConfig(
+    addresses = config.config_get(
         self.host.main_conf,
         None,
         "email_admins_list",
         default=Exception)
-    await email.sendEmail(
+    await email.send_email(
         self.host.main_conf,
         addresses,
         SUBJECT_ADMIN,
         BODY_ADMIN.format(**data._asdict()),
         )
-    await email.sendEmail(
+    await email.send_email(
         self.host.main_conf,
         data.email,
         SUBJECT,
--- a/pages/documentation/page_meta.py	Tue Nov 30 17:39:46 2021 +0100
+++ b/pages/documentation/page_meta.py	Mon May 22 09:11:54 2023 +0200
@@ -18,7 +18,7 @@
     template_data = request.template_data
 
     if allowed_docs is None:
-        allowed_docs = sorted(self.getConfig("sub_docs_dict", {}).keys())
+        allowed_docs = sorted(self.config_get("sub_docs_dict", {}).keys())
         try:
             allowed_docs.remove('backend')
         except KeyError:
@@ -26,7 +26,7 @@
         else:
             allowed_docs.insert(0, "backend")
     try:
-        doc_name = self.nextPath(request)
+        doc_name = self.next_path(request)
     except IndexError:
         doc_name = 'backend'
     else:
--- a/pages/news/page_meta.py	Tue Nov 30 17:39:46 2021 +0100
+++ b/pages/news/page_meta.py	Mon May 22 09:11:54 2023 +0200
@@ -14,7 +14,7 @@
 async def prepare_render(self, request):
     global service, node
     if service is None:
-        blog_dict = self.getConfig('news_blog_dict', {})
+        blog_dict = self.config_get('news_blog_dict', {})
         try:
             service = jid.JID(blog_dict['service'])
         except RuntimeError as e:
@@ -26,16 +26,16 @@
         node = blog_dict.get('node', '')
         if not blog_dict or service is None:
             log.warning(_('No value set for news_blog_dict, "news" page can\'t be used'))
-            self.pageError(request, C.HTTP_SERVICE_UNAVAILABLE)
+            self.page_error(request, C.HTTP_SERVICE_UNAVAILABLE)
 
-    data = self.getRData(request)
+    data = self.get_r_data(request)
     data['service'] = service
     data['node'] = node
 
-    # self.checkCache(
+    # self.check_cache(
     #     request, C.CACHE_PUBSUB, service=service, node=node, short="microblog")
 
     # we now need blog items, using blog common page
     # this will fill the "items" template data
-    blog_page = self.getPageByName("blog_view")
+    blog_page = self.get_page_by_name("blog_view")
     await blog_page.prepare_render(self, request)
--- a/pages/social_contract/page_meta.py	Tue Nov 30 17:39:46 2021 +0100
+++ b/pages/social_contract/page_meta.py	Mon May 22 09:11:54 2023 +0200
@@ -12,7 +12,7 @@
 
 def prepare_render(self, request):
     global social_contracts
-    session_data = self.host.getSessionData(request, session_iface.ISATSession)
+    session_data = self.host.get_session_data(request, session_iface.ISATSession)
     if session_data.locale is None:
         locale = "en"
     else:
@@ -24,7 +24,7 @@
         social_contract = social_contracts[locale]
     except KeyError:
         # we don't have the document in cache
-        build_path = self.host.getBuildPath(self.vhost_root.site_name)
+        build_path = self.host.get_build_path(self.vhost_root.site_name)
 
         if locale == "fr":
             # main social contract is in French, so we don't have suffix in this case
--- a/tasks/task_generate_doc.py	Tue Nov 30 17:39:46 2021 +0100
+++ b/tasks/task_generate_doc.py	Mon May 22 09:11:54 2023 +0200
@@ -17,11 +17,11 @@
     def prepare(self):
         to_watch = set()
         # root documentation
-        self.doc_path = self.getConfig("doc_path")
+        self.doc_path = self.config_get("doc_path")
         if self.doc_path is not None:
             to_watch.add(self.doc_path)
         # sub docs will be generated before the root documentation
-        self.sub_docs = self.getConfig("sub_docs_dict", value_type="path")
+        self.sub_docs = self.config_get("sub_docs_dict", value_type="path")
         if self.sub_docs is not None:
             for d in list(self.sub_docs.values()):
                 to_watch.add(d)
@@ -44,7 +44,7 @@
 
         # we first generate the sub documentations
         for name, sub_doc_path in list(self.sub_docs.items()):
-            sub_dir = regex.pathEscape(name or '')
+            sub_dir = regex.path_escape(name or '')
             build_path = os.path.join(self.build_path, 'doc', sub_dir)
             await self.runCommand(
                 sys.executable, "-m", "sphinx", sub_doc_path, build_path,
--- a/tasks/task_social_contract.py	Tue Nov 30 17:39:46 2021 +0100
+++ b/tasks/task_social_contract.py	Mon May 22 09:11:54 2023 +0200
@@ -14,7 +14,7 @@
 class Task(task.Task):
 
     def start(self):
-        sat_path = self.getConfig("sat_repos_path")
+        sat_path = self.config_get("sat_repos_path")
         for filepath in glob.glob(os.path.join(sat_path, "CONTRAT_SOCIAL*")):
             filename = os.path.basename(filepath)
             with open(filepath) as f: