NOPUBLISH seems to work
This commit is contained in:
parent
56e28a5cd7
commit
9c3c37a727
@ -25,6 +25,13 @@ use/prefer public interfaces ? (export functions)
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def try_deleting (files):
|
||||||
|
for f in files:
|
||||||
|
try:
|
||||||
|
os.remove(f)
|
||||||
|
except OSError as e:
|
||||||
|
pass
|
||||||
|
|
||||||
def main (args):
|
def main (args):
|
||||||
p = ArgumentParser("Check for pads that have changed since last sync (according to .meta.json)")
|
p = ArgumentParser("Check for pads that have changed since last sync (according to .meta.json)")
|
||||||
p.add_argument("padid", nargs="*", default=[])
|
p.add_argument("padid", nargs="*", default=[])
|
||||||
@ -59,13 +66,6 @@ def main (args):
|
|||||||
# maxmsglen = 0
|
# maxmsglen = 0
|
||||||
count = 0
|
count = 0
|
||||||
for i, padid in enumerate(padids):
|
for i, padid in enumerate(padids):
|
||||||
# TODO...
|
|
||||||
"""
|
|
||||||
Self-contained documents / and/or document receipts
|
|
||||||
storing enough information to reconstruct (or understand an error occurred)
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
if args.skip != None and i<args.skip:
|
if args.skip != None and i<args.skip:
|
||||||
continue
|
continue
|
||||||
progressbar(i, numpads, padid)
|
progressbar(i, numpads, padid)
|
||||||
@ -143,16 +143,20 @@ storing enough information to reconstruct (or understand an error occurred)
|
|||||||
|
|
||||||
if args.all or args.text:
|
if args.all or args.text:
|
||||||
text = getjson(info['apiurl']+'getText?'+urlencode(data))
|
text = getjson(info['apiurl']+'getText?'+urlencode(data))
|
||||||
|
|
||||||
##ENFORCE NOPUBLISH MAGIC WORD
|
|
||||||
if args.nopublish and args.nopublish in text:
|
|
||||||
continue
|
|
||||||
|
|
||||||
ver = {"type": "text"}
|
ver = {"type": "text"}
|
||||||
versions.append(ver)
|
versions.append(ver)
|
||||||
ver["code"] = text["_code"]
|
ver["code"] = text["_code"]
|
||||||
if text["_code"] == 200:
|
if text["_code"] == 200:
|
||||||
text = text['data']['text']
|
text = text['data']['text']
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
## ENFORCE __NOPUBLISH__ MAGIC WORD
|
||||||
|
##########################################
|
||||||
|
if args.nopublish and args.nopublish in text:
|
||||||
|
# NEED TO PURGE ANY EXISTING DOCS
|
||||||
|
try_deleting((p+".raw.txt",p+".raw.html",p+".diff.html",p+".meta.json"))
|
||||||
|
continue
|
||||||
|
|
||||||
ver["path"] = p+".raw.txt"
|
ver["path"] = p+".raw.txt"
|
||||||
ver["url"] = quote(ver["path"])
|
ver["url"] = quote(ver["path"])
|
||||||
with open(ver["path"], "w") as f:
|
with open(ver["path"], "w") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user