comparison frontends/src/jp/cmd_blog.py @ 1924:70b1a29e1338

jp (blog): force deletion (without backup) when content is empty
author Goffi <goffi@goffi.org>
date Tue, 22 Mar 2016 23:33:55 +0100
parents e28c6c4dffa5
children 53b51866747f
comparison
equal deleted inserted replaced
1923:e28c6c4dffa5 1924:70b1a29e1338
308 content_path=content_file_path, meta_path=meta_file_path), error=True) 308 content_path=content_file_path, meta_path=meta_file_path), error=True)
309 self.host.quit(0) 309 self.host.quit(0)
310 310
311 if len(content) == 0: 311 if len(content) == 0:
312 self.disp(u"Content is empty, cancelling the blog edition") 312 self.disp(u"Content is empty, cancelling the blog edition")
313 self.disp(u"Deletion of {}".format(content_file_path.decode('utf-8')), 2)
314 os.unlink(content_file_path)
315 self.disp(u"Deletion of {}".format(meta_file_path.decode('utf-8')), 2)
316 os.unlink(meta_file_path)
317 self.host.quit()
313 318
314 # time to re-check the hash 319 # time to re-check the hash
315 elif (tmp_ori_hash == hashlib.sha1(content).digest() and 320 elif (tmp_ori_hash == hashlib.sha1(content).digest() and
316 meta_ori == mb_data): 321 meta_ori == mb_data):
317 self.disp(u"The content has not been modified, cancelling the blog edition") 322 self.disp(u"The content has not been modified, cancelling the blog edition")