Browse Source

Add more reasoning

main
Luke Murphy 4 years ago
parent
commit
cdd255c5bb
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 18
      etherpump/commands/pull.py

18
etherpump/commands/pull.py

@ -215,6 +215,7 @@ async def handle_pad(args, padid, data, info, session):
revisions = response["data"]["revisions"]
if meta["revisions"] == revisions and not args.force:
skip = True
reason = "No new revisions, we already have the latest local copy"
break
meta["padid"] = padid
@ -234,6 +235,7 @@ async def handle_pad(args, padid, data, info, session):
if (meta["revisions"] == 0) and (not args.zerorevs):
skip = True
reason = "0 revisions, this pad was never edited"
break
# todo: load more metadata!
@ -261,6 +263,7 @@ async def handle_pad(args, padid, data, info, session):
file=sys.stderr,
)
skip = True
reason = "PANIC, couldn't download the pad contents"
break
else:
await trio.sleep(1)
@ -272,10 +275,11 @@ async def handle_pad(args, padid, data, info, session):
file=sys.stderr,
)
skip = True
reason = "PANIC, couldn't download the pad contents"
break
if skip:
print("[ ] {} (skipped)".format(padid))
print("[ ] {} (skipped, reason: {})".format(padid, reason))
return
if args.output:
@ -286,7 +290,7 @@ async def handle_pad(args, padid, data, info, session):
path = trio.Path(os.path.split(metapath)[0])
await path.mkdir()
except OSError:
pass
print("PANIC: unable to create {}".format(str(path)))
if args.all or args.text:
url = info["localapiurl"] + "getText?" + urlencode(data)
@ -310,7 +314,11 @@ async def handle_pad(args, padid, data, info, session):
p + ".meta.json",
)
)
print("[ ] {} (no publish)".format(padid))
print(
"[ ] {} (deleted, reason: explicit __NOPUBLISH__)".format(
padid
)
)
return
##########################################
@ -325,7 +333,7 @@ async def handle_pad(args, padid, data, info, session):
p + ".meta.json",
)
)
print("[ ] {} (publish opt out)".format(padid))
print("[ ] {} (deleted, reason: publish opt-out)".format(padid))
return
ver["path"] = p + raw_ext
@ -443,7 +451,7 @@ async def handle_pad(args, padid, data, info, session):
async with await trio.open_file(metapath, "w") as f:
await f.write(json.dumps(meta))
print("[x] {}".format(padid))
print("[x] {} (saved)".format(padid))
async def handle_pads(args):

Loading…
Cancel
Save