CLI: fix section used for config following name change

This commit is contained in:
Goffi 2021-08-27 14:46:52 +02:00
commit c8572b8f21
3 changed files with 11 additions and 7 deletions

View file

@ -49,7 +49,7 @@ class Get(base.CommandBase):
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:

View file

@ -635,7 +635,9 @@ class Edit(base.CommandBase, BlogPublishCommon, common.BaseEdit):
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 @@ class Preview(base.CommandBase, common.BaseEdit):
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 @@ class Preview(base.CommandBase, common.BaseEdit):
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

View file

@ -199,13 +199,13 @@ class BaseEdit(object):
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