changeset 3626:82e616b70a2a

CLI: fix section used for config following name change
author Goffi <goffi@goffi.org>
date Fri, 27 Aug 2021 14:46:52 +0200
parents 422049bb81d3
children 7fe1028acab2
files sat_frontends/jp/cmd_avatar.py sat_frontends/jp/cmd_blog.py sat_frontends/jp/common.py
diffstat 3 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_avatar.py	Mon Aug 02 21:47:22 2021 +0200
+++ b/sat_frontends/jp/cmd_avatar.py	Fri Aug 27 14:46:52 2021 +0200
@@ -49,7 +49,7 @@
 
     async def showImage(self, path):
         sat_conf = config.parseMainConf()
-        cmd = config.getConfig(sat_conf, "jp", "image_cmd")
+        cmd = config.getConfig(sat_conf, C.CONFIG_SECTION, "image_cmd")
         cmds = [cmd] + DISPLAY_CMD if cmd else DISPLAY_CMD
         for cmd in cmds:
             try:
--- a/sat_frontends/jp/cmd_blog.py	Mon Aug 02 21:47:22 2021 +0200
+++ b/sat_frontends/jp/cmd_blog.py	Fri Aug 27 14:46:52 2021 +0200
@@ -635,7 +635,9 @@
 
     async def start(self):
         # if there are user defined extension, we use them
-        SYNTAX_EXT.update(config.getConfig(self.sat_conf, "jp", CONF_SYNTAX_EXT, {}))
+        SYNTAX_EXT.update(
+            config.getConfig(self.sat_conf, C.CONFIG_SECTION, CONF_SYNTAX_EXT, {})
+        )
         self.current_syntax = await self.get_current_syntax()
 
         (
@@ -780,11 +782,13 @@
             aionotify = None
 
         sat_conf = self.sat_conf
-        SYNTAX_EXT.update(config.getConfig(sat_conf, "jp", CONF_SYNTAX_EXT, {}))
+        SYNTAX_EXT.update(
+            config.getConfig(sat_conf, C.CONFIG_SECTION, CONF_SYNTAX_EXT, {})
+        )
 
         try:
             self.open_cb_cmd = config.getConfig(
-                sat_conf, "jp", "blog_preview_open_cmd", Exception
+                sat_conf, C.CONFIG_SECTION, "blog_preview_open_cmd", Exception
             )
         except (NoOptionError, NoSectionError):
             self.open_cb_cmd = None
@@ -793,7 +797,7 @@
             open_cb = self.openPreviewExt
 
         self.update_cb_cmd = config.getConfig(
-            sat_conf, "jp", "blog_preview_update_cmd", self.open_cb_cmd
+            sat_conf, C.CONFIG_SECTION, "blog_preview_update_cmd", self.open_cb_cmd
         )
         if self.update_cb_cmd is None:
             update_cb = self.showPreview
--- a/sat_frontends/jp/common.py	Mon Aug 02 21:47:22 2021 +0200
+++ b/sat_frontends/jp/common.py	Fri Aug 27 14:46:52 2021 +0200
@@ -199,13 +199,13 @@
         content_file_obj.close()
 
         # we prepare arguments
-        editor = config.getConfig(self.sat_conf, "jp", "editor") or os.getenv(
+        editor = config.getConfig(self.sat_conf, C.CONFIG_SECTION, "editor") or os.getenv(
             "EDITOR", "vi"
         )
         try:
             # is there custom arguments in sat.conf ?
             editor_args = config.getConfig(
-                self.sat_conf, "jp", editor_args_opt, Exception
+                self.sat_conf, C.CONFIG_SECTION, editor_args_opt, Exception
             )
         except (NoOptionError, NoSectionError):
             # no, we check if we know the editor and have special arguments