Mercurial > libervia-backend
comparison sat_frontends/jp/cmd_blog.py @ 3241:46f0b388eeea
jp (blog/edit): --no-publish is a boolean option
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 31 Mar 2020 08:45:49 +0200 |
parents | f4914ce9d47d |
children | 384283adcce1 |
comparison
equal
deleted
inserted
replaced
3240:d85b68e44297 | 3241:46f0b388eeea |
---|---|
466 action="store_true", | 466 action="store_true", |
467 help=_("launch a blog preview in parallel"), | 467 help=_("launch a blog preview in parallel"), |
468 ) | 468 ) |
469 self.parser.add_argument( | 469 self.parser.add_argument( |
470 "--no-publish", | 470 "--no-publish", |
471 action="store_true", | |
471 help=_('add "publish: False" to metadata'), | 472 help=_('add "publish: False" to metadata'), |
472 ) | 473 ) |
473 | 474 |
474 def buildMetadataFile(self, content_file_path, mb_data=None): | 475 def buildMetadataFile(self, content_file_path, mb_data=None): |
475 """Build a metadata file using json | 476 """Build a metadata file using json |
508 except KeyError: | 509 except KeyError: |
509 pass | 510 pass |
510 # and override metadata with command-line arguments | 511 # and override metadata with command-line arguments |
511 self.setMbDataFromArgs(mb_data) | 512 self.setMbDataFromArgs(mb_data) |
512 | 513 |
513 if self.args.no_publish is not None: | 514 if self.args.no_publish: |
514 mb_data["publish"] = False | 515 mb_data["publish"] = False |
515 | 516 |
516 # then we create the file and write metadata there, as JSON dict | 517 # then we create the file and write metadata there, as JSON dict |
517 # XXX: if we port jp one day on Windows, O_BINARY may need to be added here | 518 # XXX: if we port jp one day on Windows, O_BINARY may need to be added here |
518 with os.fdopen( | 519 with os.fdopen( |