Browse Source

Add `__PUBLISH__` logic

Closes https://gitlab.constantvzw.org/aa/etherdump/issues/3.

This allows for the following to be run:

    etherdump pull --publish-opt-in --all --pub mydump

And if `__PUBLISH__` is not present on the pads, then the pad will not
be archived. It is also possible to configure this magic word by
specifying the `--publish ...` option.
publish-vs-nopublish
Luke Murphy 6 years ago
parent
commit
f9bb4444e2
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 9
      etherdump/commands/pull.py

9
etherdump/commands/pull.py

@ -69,6 +69,8 @@ def main (args):
p.add_argument("--script", default="/versions.js", help="add script url to output pages, default: /versions.js")
p.add_argument("--nopublish", default="__NOPUBLISH__", help="no publish magic word, default: __NOPUBLISH__")
p.add_argument("--publish", default="__PUBLISH__", help="the publish magic word, default: __PUBLISH__")
p.add_argument("--publish-opt-in", default=False, action="store_true", help="ensure `--publish` is honoured instead of `--nopublish`")
args = p.parse_args(args)
@ -187,6 +189,13 @@ def main (args):
try_deleting((p+raw_ext,p+".raw.html",p+".diff.html",p+".meta.json"))
continue
##########################################
## ENFORCE __PUBLISH__ MAGIC WORD
##########################################
if args.publish_opt_in and args.publish not in text:
try_deleting((p+raw_ext,p+".raw.html",p+".diff.html",p+".meta.json"))
continue
ver["path"] = p+raw_ext
ver["url"] = quote(ver["path"])
with open(ver["path"], "w") as f:

Loading…
Cancel
Save