Skip to content

Commit

Permalink
better error msg: rev id not found
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Dec 18, 2023
1 parent 3605cd1 commit 4edca08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dokuWikiDumper/dump/content/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ def dump_page(dumpDir: str,
except DispositionHeaderMissingError:
print(msg_header, ' Revision %s of [[%s]] is empty. (probably deleted)' % (
rev['id'], title))
else:
print(msg_header, ' Revision %s of [[%s]] failed: %s' % (rev['id'], title, 'Rev id not found (please check ?do=revisions of this page)'))


# time.sleep(1.5)

2 changes: 2 additions & 0 deletions dokuWikiDumper/dump/content/revisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ def save_page_changes(dumpDir, title: str, revs, child_path, msg_header: str):
rev_id = None

assert rev_id is not None, 'Cannot parse date: %s' % rev['date']
assert isinstance(rev_id, str), 'rev_id must be str, not %s' % type(rev_id)

# if rev_id is not unique, plus 1 to it until it is.
while rev_id in revidOfPage:
rev_id = str(int(rev_id) + 1)
Expand Down
3 changes: 2 additions & 1 deletion dokuWikiDumper/dump/html/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def dump_html_page(dumpDir, index_of_title, title, doku_url, session: requests.S
print(msg_header, ' Revision %s of [[%s]] saved.' % (rev['id'], title))
except requests.HTTPError as e:
print(msg_header, ' Revision %s of [[%s]] failed: %s' % (rev['id'], title, e))

else:
print(msg_header, ' Revision %s of [[%s]] failed: %s' % (rev['id'], title, 'Rev id not found (please check ?do=revisions of this page)'))

save_page_changes(dumpDir=dumpDir, child_path=child_path, title=title,
revs=revs, msg_header=msg_header)

0 comments on commit 4edca08

Please sign in to comment.