handle exceptions

This commit is contained in:
Michael Murtaugh 2015-08-25 20:00:59 +02:00
parent d3732a1aee
commit 30c9247518
2 changed files with 163 additions and 157 deletions

View File

@ -101,6 +101,8 @@ while len(todo) > 0:
except OSError: except OSError:
pass pass
try:
# _ # _
# _ __ ___ ___| |_ __ _ # _ __ ___ ___| |_ __ _
# | '_ ` _ \ / _ \ __/ _` | # | '_ ` _ \ / _ \ __/ _` |
@ -184,6 +186,7 @@ while len(todo) > 0:
for l in links: for l in links:
if l not in todo and l not in done: if l not in todo and l not in done:
if l.startswith("http://") or l.startswith("https://"): if l.startswith("http://") or l.startswith("https://"):
if args.verbose:
print ("Ignoring absolute URL in [[ link ]] form", file=sys.stderr) print ("Ignoring absolute URL in [[ link ]] form", file=sys.stderr)
continue continue
# if args.verbose: # if args.verbose:
@ -269,3 +272,5 @@ while len(todo) > 0:
count += 1 count += 1
if args.limit and count >= args.limit: if args.limit and count >= args.limit:
break break
except TypeError:
print ("ERROR, skipping!", file=sys.stderr)

View File

@ -26,7 +26,8 @@ def linkify (src, urlify=urlify):
# src = re.sub(r"\[\[([\w_\- ,]+?)\]\]", s, src) # src = re.sub(r"\[\[([\w_\- ,]+?)\]\]", s, src)
## question marks are ignored by etherpad, so split/strip it ## question marks are ignored by etherpad, so split/strip it
src = re.sub(r"\[\[(.+?)(\?.*)?\]\]", s, src) ## strip slashes as well!! (/timeslider)
src = re.sub(r"\[\[(.+?)(\/.*)?(\?.*)?\]\]", s, src)
return (src, collect) return (src, collect)