changeset 2944:efb915a20d5d

jp (blog/set): fixed missing current_syntax
author Goffi <goffi@goffi.org>
date Sun, 05 May 2019 18:50:35 +0200
parents 781b5b6a33ee
children 6c264c224614
files sat_frontends/jp/cmd_blog.py
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_blog.py	Sun May 05 18:50:32 2019 +0200
+++ b/sat_frontends/jp/cmd_blog.py	Sun May 05 18:50:35 2019 +0200
@@ -43,6 +43,8 @@
 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 @@
 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 @@
         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 @@
         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(