base (blog/edit): added a way to block publishing by adding "publish": "false" in metadata file

This commit is contained in:
Goffi 2016-03-02 19:46:01 +01:00
commit 41f19f63ec

View file

@ -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")