]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/lib/python/hgext/hgwebfs.py
hgwebfs: simplify retry loop construction
[plan9front.git] / sys / lib / python / hgext / hgwebfs.py
index 5a5b260ebe87a4a0507fde01481da2b7c8e72194..430269cf1ffde9de5eab2ea46419a091b2aa3637 100644 (file)
@@ -6,20 +6,20 @@ import os
 
 class Webconn:
        def __init__(self, mnt, req):
-               try:
-                       self.open(mnt, req)
-               except IOError, e:
+               while True:
                        try:
-                               errstr = e.strerror
-                               params = errstr[errstr.index("needkey ")+8:]
-                               if params.find("!password?") < 0:
-                                       raise e
-                               if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
-                                       raise e
                                self.open(mnt, req)
                                return
-                       except:
-                               raise e
+                       except IOError, e:
+                               try:
+                                       errstr = e.strerror
+                                       params = errstr[errstr.index("needkey ")+8:]
+                                       if params.find("!password?") < 0:
+                                               raise e
+                                       if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
+                                               raise e
+                               except:
+                                       raise e
 
        def open(self, mnt, req):
                if type(req) == str: