comparison frontends/src/jp/cmd_blog.py @ 1870:c25077c87b1d

base (blog/edit): added a way to block publishing by adding "publish": "false" in metadata file
author Goffi <goffi@goffi.org>
date Wed, 02 Mar 2016 19:46:01 +0100
parents 28b29381db75
children 64a40adccba4
comparison
equal deleted inserted replaced
1869:9d9d61d53684 1870:c25077c87b1d
147 except ValueError: 147 except ValueError:
148 self.disp(u"Can't parse metadata, please check it is correct JSON format. Cancelling edition.\n" + 148 self.disp(u"Can't parse metadata, please check it is correct JSON format. Cancelling edition.\n" +
149 "You can find tmp file at {file_path} and temporary meta file at {meta_path}.".format( 149 "You can find tmp file at {file_path} and temporary meta file at {meta_path}.".format(
150 file_path=tmp_file_path, meta_path=meta_file_path), error=True) 150 file_path=tmp_file_path, meta_path=meta_file_path), error=True)
151 self.host.quit(1) 151 self.host.quit(1)
152
153 if not C.bool(mb_data.get('publish', "true")):
154 self.disp(u'Publication blocked by "publish" key in metadata, cancelling edition.\n\n' +
155 "temporary file path:\t{file_path}\nmetadata file path:\t{meta_path}".format(
156 file_path=tmp_file_path, meta_path=meta_file_path), error=True)
157 self.host.quit(0)
152 158
153 if len(content) == 0: 159 if len(content) == 0:
154 self.disp(u"Content is empty, cancelling the blog edition") 160 self.disp(u"Content is empty, cancelling the blog edition")
155 161
156 # time to re-check the hash 162 # time to re-check the hash