changeset 4509:5e5b5ddbae4a

Small download url loop add refactor..
author Jan Nieuwenhuizen <janneke@gnu.org>
date Sat, 25 Oct 2008 22:42:19 +0200
parents 97d005d2b277
children ff2c9c9371f1
files gub/misc.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gub/misc.py	Sat Oct 25 11:15:12 2008 +0200
+++ b/gub/misc.py	Sat Oct 25 22:42:19 2008 +0200
@@ -212,7 +212,9 @@
 
     candidate_urls = []
     for url in local + cache + [original_url] + fallback:
-        if url and os.path.exists (url):
+        if not url:
+            continue
+        if os.path.exists (url):
             url = 'file://' + url
         if url == original_url:
             candidate_urls.append (url)
@@ -440,6 +442,9 @@
 
         if (t == new_text and must_succeed):
             raise Exception ('nothing changed!')
+        else:
+            if must_succeed and type (must_succeed) == type (0):
+                must_succeed -= 1
         t = new_text
 
     if s != t or (to_name and name != to_name):