From 41f19f63ec3e58fa42874390967a544502e6a801 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 2 Mar 2016 19:46:01 +0100 Subject: [PATCH] base (blog/edit): added a way to block publishing by adding "publish": "false" in metadata file --- frontends/src/jp/cmd_blog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontends/src/jp/cmd_blog.py b/frontends/src/jp/cmd_blog.py index 3f0968b3..57b97bf3 100644 --- a/frontends/src/jp/cmd_blog.py +++ b/frontends/src/jp/cmd_blog.py @@ -150,6 +150,12 @@ class Edit(base.CommandBase): file_path=tmp_file_path, meta_path=meta_file_path), error=True) self.host.quit(1) + if not C.bool(mb_data.get('publish', "true")): + self.disp(u'Publication blocked by "publish" key in metadata, cancelling edition.\n\n' + + "temporary file path:\t{file_path}\nmetadata file path:\t{meta_path}".format( + file_path=tmp_file_path, meta_path=meta_file_path), error=True) + self.host.quit(0) + if len(content) == 0: self.disp(u"Content is empty, cancelling the blog edition")