From 9a50da7f079caedde30d63bc0fc1e4c02891eb9b Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 5 May 2019 18:50:35 +0200 Subject: [PATCH] jp (blog/set): fixed missing current_syntax --- sat_frontends/jp/cmd_blog.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sat_frontends/jp/cmd_blog.py b/sat_frontends/jp/cmd_blog.py index d37ef177..0c6acd9c 100644 --- a/sat_frontends/jp/cmd_blog.py +++ b/sat_frontends/jp/cmd_blog.py @@ -43,6 +43,8 @@ __commands__ = ["Blog"] SYNTAX_XHTML = u"xhtml" # extensions to use with known syntaxes SYNTAX_EXT = { + # FIXME: default syntax doesn't sounds needed, there should always be a syntax set + # by the plugin. "": "txt", # used when the syntax is not found SYNTAX_XHTML: "xhtml", "markdown": "md", @@ -105,6 +107,14 @@ def guessSyntaxFromPath(host, sat_conf, path): class BlogPublishCommon(object): """handle common option for publising commands (Set and Edit)""" + @property + def current_syntax(self): + if self._current_syntax is None: + self._current_syntax = self.host.bridge.getParamA( + "Syntax", "Composition", "value", self.profile + ) + return self._current_syntax + def add_parser_options(self): self.parser.add_argument( "-T", "--title", type=base.unicode_decoder, help=_(u"title of the item") @@ -180,6 +190,7 @@ class Set(base.CommandBase, BlogPublishCommon): self.host.quit(C.EXIT_OK) def start(self): + self._current_syntax = self.args.syntax self.pubsub_item = self.args.item mb_data = {} self.setMbDataFromArgs(mb_data) @@ -432,14 +443,6 @@ class Edit(base.CommandBase, BlogPublishCommon, common.BaseEdit): BlogPublishCommon.__init__(self) common.BaseEdit.__init__(self, self.host, BLOG_TMP_DIR, use_metadata=True) - @property - def current_syntax(self): - if self._current_syntax is None: - self._current_syntax = self.host.bridge.getParamA( - "Syntax", "Composition", "value", self.profile - ) - return self._current_syntax - def add_parser_options(self): BlogPublishCommon.add_parser_options(self) self.parser.add_argument(