Mercurial > libervia-backend
comparison frontends/src/jp/cmd_blog.py @ 1927:03f780b60d5d
jp (blog/edit): added forgotten O_TRUNC while opening metadata file
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 25 Mar 2016 12:06:50 +0100 |
parents | 55a7328fafb6 |
children | b603a3d516d3 |
comparison
equal
deleted
inserted
replaced
1926:55a7328fafb6 | 1927:03f780b60d5d |
---|---|
243 if self.args.title is not None: | 243 if self.args.title is not None: |
244 mb_data['title'] = self.args.title | 244 mb_data['title'] = self.args.title |
245 | 245 |
246 # then we create the file and write metadata there, as JSON dict | 246 # then we create the file and write metadata there, as JSON dict |
247 # XXX: if we port jp one day on Windows, O_BINARY may need to be added here | 247 # XXX: if we port jp one day on Windows, O_BINARY may need to be added here |
248 with os.fdopen(os.open(meta_file_path, os.O_RDWR | os.O_CREAT ,0o600), 'w+b') as f: | 248 with os.fdopen(os.open(meta_file_path, os.O_RDWR | os.O_CREAT | os.O_TRUNC,0o600), 'w+b') as f: |
249 # we need to use an intermediate unicode buffer to write to the file unicode without escaping characters | 249 # we need to use an intermediate unicode buffer to write to the file unicode without escaping characters |
250 unicode_dump = json.dumps(mb_data, ensure_ascii=False, indent=4, separators=(',', ': '), sort_keys=True) | 250 unicode_dump = json.dumps(mb_data, ensure_ascii=False, indent=4, separators=(',', ': '), sort_keys=True) |
251 f.write(unicode_dump.encode('utf-8')) | 251 f.write(unicode_dump.encode('utf-8')) |
252 | 252 |
253 return mb_data, meta_file_path | 253 return mb_data, meta_file_path |