Return last successful result if recursive resolving encounters a dead end

develop
Sven Slootweg 13 years ago
parent 89477c0b1b
commit bbee90277e

@ -12,10 +12,15 @@ def resolve(url):
return {} return {}
def recurse(url): def recurse(url):
previous_result = {}
while True: while True:
result = resolve(url) result = resolve(url)
if 'url' not in result: if result == {}:
return previous_result
elif 'url' not in result:
return result return result
url = result['url'] url = result['url']
previous_result = result

Loading…
Cancel
Save