hgwebfs: make hgwebfs prompt for password
This commit is contained in:
parent
c8d1a885f8
commit
15fd826147
1 changed files with 17 additions and 0 deletions
|
@ -2,9 +2,26 @@
|
|||
|
||||
import mercurial.url
|
||||
import re
|
||||
import os
|
||||
|
||||
class Webconn:
|
||||
def __init__(self, mnt, req):
|
||||
try:
|
||||
self.open(mnt, req)
|
||||
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
|
||||
self.open(mnt, req)
|
||||
return
|
||||
except:
|
||||
raise e
|
||||
|
||||
def open(self, mnt, req):
|
||||
if type(req) == str:
|
||||
self.url = req
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue